This is my first post on here, I will try to be as clear as possible :)
I'm creating a Microsoft Word form for users to fill in, this form is protected and only the forms can be filled in the rest of the document is protected with the password: "mypass"
I want to have a button on the document it self wich prints the active document. What I did is create a print button into a “drawing” Textbox ( Insert | Textbox ) as stated here.
This Print button must be hidden so it's not visible on the document when it's printed.
Here is the code:
Private Sub CommandButton1_Click()
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="mypass"
End If
With ActiveDocument
.Shapes(1).Visible = msoFalse
.PrintOut Copies:=1
.Shapes(1).Visible = msoTrue
End With
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, Password:="mypass"
End Sub
When I click the print button in protective mode nothing happens, when I turn off protective mode I get this error:
Error 4641 at run.
ToolsProtectDocument statement is currently disabled
To summarize:
The Print button I created does not work when protective mode is enabled. When protective mode is disabled I get the error that the ToolsProtectDocument statement is currently disabled.
I want to have a procted form that can be filled in and be printed from the form itself without the print button being visable on the printed form.
Does anyone have a clue?