Passwords not saved when calling FileSaveAs dialog from VBA

Article contributed by Ibby

If you call the FileSaveAs dialog (Word 97) with the following code:

Dialogs(wdDialogFileSaveAs).Show

the passwords entered under Options – Password to Open, Password to Modify do not stick.

There are two workarounds, depending on whether you need to change the settings in the dialog via code:

Either:

CommandBars.FindControl(ID:=748, Visible:=False).Execute

Or:

Dim strFileName As String

With Dialogs(wdDialogFileSaveAs)
    If .Display = -1 Then
        strFileName = .Name
        .Update
        .Name = strFileName
        .Execute
    End If
End With


Click to view Terms of Use page

Click to view Disclaimer page