Handyman84
New Member
- Joined
- May 5, 2018
- Messages
- 17
Hi Anyone know who to launch the Document Encrypt Dialog without send keys to protect the workbook?
For clarity it's not this one Application.Dialogs(xlDialogWorkbookProtect).show
As an example of sendkeys version that works here's an example, but would prefer an API or Application.Dialogs way to launch as the send key's provides no feedback.
Thanks
For clarity it's not this one Application.Dialogs(xlDialogWorkbookProtect).show
As an example of sendkeys version that works here's an example, but would prefer an API or Application.Dialogs way to launch as the send key's provides no feedback.
VBA Code:
Sub ShowEncryptDialog()
'Adapted from https://stackoverflow.com/questions/27104205/display-the-file-print-menu-via-vba
'Show File Document Encrypt Dialog
On Error Resume Next
Set CBC = Application.VBE.CommandBars.FindControl(id:=752)
On Error GoTo 0
If Not CBC Is Nothing Then
CBC.Execute
DoEvents
'~~> File -->Info-->Protect-->Encrypt
Sendkeys "%fipe"
End If
End Sub
Thanks