It may be necessary to complete an action in Word or Excel and then automatically pop up a ‘Save As’ dialogue . |
Here is the code that will produce a Save window with the pre-populated name of ‘MyFileName’.
Dim fNameText As String
fNameText = “MyFileName”
With Dialogs(wdDialogFileSaveAs)
.Name = fNameText
.Show
End With
In the above example I have declared a variable, assigned it some text and then used the variable to populate the filename in the Save As dialogue.
Therefore, when the user saves the document it will be called “MyFileName.doc”.
NB. You could also just add the filename directly without a variable :
With Dialogs(wdDialogFileSaveAs)
.Name = “MyFileName”
.Show
End With
No comments:
Post a Comment