![]() |
|
#4
|
|||
|
|||
|
OK.
Then your new document is formed when the user double-clicks on the template or uses one of the File New Variations to create a new file. The user does NOT open the template. You can use your UserForm's OK click event to open the File Save As dialog with your proposed name or simply save the document with the name you want. Simply use the variable information you already have to create your filename string Here is code that I use in one of my forms to insert the current date as a part of the name. Code:
Private Sub SaveAsLetter()
' Run as part of first step - saves letters using preferred format for name
Dim strName As String, dlgSave As Dialog
Set dlgSave = Dialogs(wdDialogFileSaveAs)
strName = "Letter " & Format((Year(Now() + 1) Mod 100), "20##") & "-" & _
Format((Month(Now() + 1) Mod 100), "0#") & "-" & _
Format((Day(Now()) Mod 100), "0#")
ActiveDocument.BuiltInDocumentProperties("Title").Value = strName
With dlgSave
.Name = strName
.Show
End With
End Sub
You would use the ChangeFileOpenDirectory method to change to the folder you want to use. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I save a Word file with a macro for distribution? | leemoreau | Word VBA | 3 | 10-04-2013 08:06 AM |
Macro to create new word doc and save the file using String found in the document
|
VBNation | Word VBA | 2 | 02-08-2013 07:14 AM |
A newbie question: a must to save macro word file as .docm?
|
tinfanide | Word VBA | 6 | 12-06-2011 03:02 PM |
Word Macro: Save file as text with current file name
|
jabberwocky12 | Word VBA | 2 | 10-22-2010 12:23 PM |
| Macro will not save to normal.dot file when exiting | bobbraun | Word | 1 | 09-28-2010 06:26 AM |