#1
|
|||
|
|||
Add a "SAVE" Button to a form template?
Here is the skinny:
I have individual/job specific form templates created for multiple users who update their weekly project info, which is then reviewed at a meeting by a manager who also makes changes to the generated document. Issue: For the first user who double clicks their form template, e.g. "Bob's.dotx", creating a "new" .docx (default titled as "Document1"), that user fills out their form and must currently choose SAVE AS> from the ribbon, rename it and then navigate through the drive/network locations to save their document in a common storage area with the desired file name such as the date of the meeting. This is an issue because our shared network is massive and spread amongst many drives and some of our users are PC challenged. Desired solution: be able to add a button to the form, that once filled out, can be clicked by the user and the form saved automatically to a predetermined file location/name without prompting. Is this possible? Thanks! Last edited by Dave L; 03-16-2012 at 08:22 AM. Reason: Not on Windows 7 at work still XP :-( |
#2
|
||||
|
||||
Hi Dave,
You could add code like the following to each template's 'ThisDocument' module. As coded, it prompts the user to save the file immediately it's created and defaults to whatever path is specified for the StrTmpPath variable and with whatever filename's specified for the StrName variable (which i've coded for the user's name and the system date in ISO format. Code:
Private Sub Document_New() Dim StrName As String, StrDefPath As String, StrTmpPath As String StrName = Environ("UserName") & Format(Now, "YYYYMMDD") StrTmpPath = "Filepath for documents based on this template" StrDefPath = Options.DefaultFilePath(wdDocumentsPath) Options.DefaultFilePath(wdDocumentsPath) = StrTmpPath With Application.Dialogs(wdDialogFileSaveAs) .Name = StrName .Show End With Options.DefaultFilePath(wdDocumentsPath) = StrDefPath End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks!!
I will give this a try tomorrow to test the functionality. PS- I'm no Word expert...., I assume I enter this in the Visual Basic "code view" section of the form? Thanks again for the help!! |
#4
|
||||
|
||||
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
I get an error with the line "Options.DefaultFilePath..."
Didn't get a chance to copy down the details. I'll post back tomorrow |
#6
|
||||
|
||||
Quote:
StrTmpPath = "Filepath for documents based on this template" You need to put your own path between the quotes.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Path and name are entered.
Its this one; Options.DefaultFilePath(wdDocumentsPath) = StrTmpPath When all the code is entered and I attempt to exit it yields the error, which I apologize I can't remember right now. |
#8
|
||||
|
||||
That would seem to confirm that there's an issue with the filepath in your StrTmpPath variable. I suspect the error message has error code 4172 and says 'Path not found'.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
The ".DefaultFilePath" portion of that line is highlighted blue and the error window reads:
Compile Error: Invalid use of property |
#10
|
||||
|
||||
Hi Dave,
What is the content of your StrTmpPath variable? Also, what happens if you change: Options.DefaultFilePath(wdDocumentsPath) = StrTmpPath to: Options.DefaultFilePath(0) = StrTmpPath
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Disable "do you also want to save changes to the document template?" harassalog. | wornways | Word | 30 | 06-04-2016 02:32 PM |
Launch macro sub after hitting "create pdf" button in word | webharvest | Word VBA | 1 | 06-29-2011 04:56 PM |
"Back" Button - to behave like web browser (Not using last slide viewed). | emmiewoo | PowerPoint | 0 | 03-29-2011 06:54 AM |
Template "form field" & pictures - need help | MAS | Word | 3 | 02-25-2011 12:00 AM |
"Send and Receive all Folders" button missing (but only with one account) | incognitus | Outlook | 0 | 10-12-2010 10:42 PM |