Password Not Saved calling wdDialogFileSaveAs Dialog Box

S

SteveP

Problem using Word 2002 SP3
If a user opens a word file and enters a Password to open using Tools>Options>Security>Password to Open 'Password' and confirms in Confirm Password dialog ALL IS OK. Password is required to open the file as expected.
However if the user enters File>SaveAs>Tools>Security Options>Password to Open 'Password' and confirms in the Confirm Password dialog. THE PASSWORD IS NOT SAVED.
We have changed the FileSaveAs code as follows (To force users to Enter Metadata for the document)
Sub FileSaveAs()
Dim myDialog As Dialog
Dim myCMD As CommandBarControl
Set myDialog = Dialogs(wdDialogFileSaveAs)
myDialog.Name = ActiveDocument.FullName

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
myDialog.Update
If myDialog.Display = -1 Then
myDialog.Execute
End If
If ActiveDocument.Path <> "" Then
If Application.Options.SavePropertiesPrompt Then
ActiveDocument.BuiltInDocumentProperties("Title") = Left(ActiveDocument.Name, InStr(1, ActiveDocument.Name, ".") - 1)
Set myCMD = Application.CommandBars("File").FindControl(ID:=750)
If Not myCMD Is Nothing Then
myCMD.Execute
End If
If ActiveDocument.Path <> "" Then
ActiveDocument.Save
End If
End If
Else
'Cancel Pressed so Exit
End If
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top