Article ID: 169937
Article Last Modified on 1/19/2007
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:
173707 OFF97: How to Run Sample Code from Knowledge Base Articles
163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: vb vba vbe disabled disable dialog dialogbox vbapps
Keywords: kbdtacode kbhowto kbmacroexample kbprogramming KB169937