Article ID: 184157
Article Last Modified on 6/17/2005
FileSave, FileSaveAs, and Save_SaveAs
Sub FileSave()
' If the document has not been saved
' display the File SaveAs dialog.
If ActiveDocument.Saved = False Then
' Call the Save_SaveAs macro.
Save_SaveAs
Else
' Otherwise, save the document.
ActiveDocument.Save
End If
End Sub
Sub FileSaveAs()
' Call the Save_SaveAs macro.
Save_SaveAs
End Sub
Public Sub Save_SaveAs()
' **********************************************
' This macro replaces the default functionality
' of the FileSaveAs command.
' **********************************************
Dim myDialog As Dialog
Set myDialog = Dialogs(wdDialogFileSaveAs)
' Display the Dialog and save the document.
If myDialog.Display Then
ActiveDocument.SaveAs myDialog.Name, myDialog.Format, _
myDialog.LockAnnot, myDialog.Password, myDialog.AddToMru, _
myDialog.WritePassword, myDialog.RecommendReadOnly, _
myDialog.EmbedFonts, myDialog.NativePictureFormat, _
myDialog.FormsData, myDialog.SaveAsAOCELetter
End If
End Sub
For additional information, please see the following article in the
Microsoft Knowledge Base:
181058 OFF98: How to Run Sample Code from Knowledge Base Articles
163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: wordcon vb vba vbe
Keywords: kbhowto kbmacroexample kbdtacode KB184157