Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-16-2012, 08:22 AM
Dave L Dave L is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office XP
Novice
Add a "SAVE" Button to a form template?
 
Join Date: Mar 2012
Posts: 5
Dave L is on a distinguished road
Question 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 :-(
Reply With Quote
  #2  
Old 03-17-2012, 01:06 AM
macropod's Avatar
macropod macropod is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 03-19-2012, 06:10 PM
Dave L Dave L is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office XP
Novice
Add a "SAVE" Button to a form template?
 
Join Date: Mar 2012
Posts: 5
Dave L is on a distinguished road
Talking

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!!
Reply With Quote
  #4  
Old 03-19-2012, 06:14 PM
macropod's Avatar
macropod macropod is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Dave L View Post
I assume I enter this in the Visual Basic "code view" section of the form?
Yes, specifically in the template's 'ThisDocument' module. See: http://www.gmayor.com/installing_macro.htm
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 03-20-2012, 04:29 PM
Dave L Dave L is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office XP
Novice
Add a "SAVE" Button to a form template?
 
Join Date: Mar 2012
Posts: 5
Dave L is on a distinguished road
Default

I get an error with the line "Options.DefaultFilePath..."
Didn't get a chance to copy down the details. I'll post back tomorrow
Reply With Quote
  #6  
Old 03-20-2012, 05:42 PM
macropod's Avatar
macropod macropod is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
I get an error with the line "Options.DefaultFilePath..."
Which one? There are three lines with that expression. If it's the first one, that suggests you haven't updated the 'StrTmpPath' variable to reflect the filepath for document based on the template. Currently, all the code has on that line is:
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]
Reply With Quote
  #7  
Old 03-20-2012, 06:00 PM
Dave L Dave L is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office XP
Novice
Add a "SAVE" Button to a form template?
 
Join Date: Mar 2012
Posts: 5
Dave L is on a distinguished road
Default

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.
Reply With Quote
  #8  
Old 03-20-2012, 06:19 PM
macropod's Avatar
macropod macropod is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #9  
Old 03-21-2012, 06:53 PM
Dave L Dave L is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office XP
Novice
Add a "SAVE" Button to a form template?
 
Join Date: Mar 2012
Posts: 5
Dave L is on a distinguished road
Default

The ".DefaultFilePath" portion of that line is highlighted blue and the error window reads:
Compile Error:
Invalid use of property
Reply With Quote
  #10  
Old 03-21-2012, 07:04 PM
macropod's Avatar
macropod macropod is offline Add a "SAVE" Button to a form template? Windows 7 64bit Add a "SAVE" Button to a form template? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

Thread Tools
Display Modes


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
Add a "SAVE" Button to a form template? 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
Add a "SAVE" Button to a form template? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft