Article ID: 184985
Article Last Modified on 6/17/2005
Dialogs(wdDialogFileSaveAs).ShowTo display the File Save As dialog box and save a password that you set (as if clicking Options in the File Save As dialog box) use the following macro commands instead of Dialogs(wdDialogFileSaveAs).Show:
Sub SaveDocPasswordWorkAround()
Dim dlg As Dialog
Dim dlgParm As String
' If no documents are open to save then exit this routine.
If Documents.Count = 0 Then Exit Sub
' Set object variable to File Save As dialog box.
Set dlg = Dialogs(wdDialogFileSaveAs)
With dlg
' Display the dialog box.
.Display
' Extract the name to save as (typed in the File Name text box).
dlgParm = .Name
' Force an update to the dialog box.
.Update
' Reset the file name.
.Name = dlgParm
' Execute the dialog box commands.
.Execute
End With
End Sub
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
Keywords: kbbug kbdtacode kbpending KB184985