Hi All;
I am almost done programing a document's VBA script. I have 1 last section of code to complete.
Objective:
Check if the document has a password
- if there is a password then sub ends
- if no bring up a box to ask the user if they want to set the password
The second msgbox will be the box to enter the new password for the document
Current issues:
- When the password is set, the script cannot correctly skip the set password section of the code.
- How do I create a way for the user to enter the new password. I've done significant research and haven't come across an answer.
Thanks,
Mike
I am almost done programing a document's VBA script. I have 1 last section of code to complete.
Objective:
Check if the document has a password
- if there is a password then sub ends
- if no bring up a box to ask the user if they want to set the password
- if yes then bring up the new password entry box
- if no end the sub
The second msgbox will be the box to enter the new password for the document
Current issues:
- When the password is set, the script cannot correctly skip the set password section of the code.
- How do I create a way for the user to enter the new password. I've done significant research and haven't come across an answer.
Code:
Sub passwordcheck_1()
Dim ButtonChosen As Integer
If ActiveDocument.HasPassword = False Then
'display message box on screen, with YES and NO buttons
ButtonChosen = MsgBox("This Document is Not Password Protected?", vbYesNo, "Password Not Set")
If ButtonChosen = 6 Then
MsgBox "This Document is Not Password Protected?", vbOKOnly, "Password Not Set"
Else
End If
Else
End If
End Sub
Thanks,
Mike