Z
zirac
I have a template with a dialogue box which will ask the name, address, etc
("lets") and have an option of OK or Cancel. The sytnax below works fine if
the user will select OK on dialogue box but an error will occur if it select
Cancel as there is no document open. So, no document to protect. Can you
please help me how will I get out with this.
Public Sub MAIN()
'Unprotect the document if protection not already disabled
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="Zaphod"
End If
WordBasic.call "lets"
'Protect the document if protection not already enabled
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Password:="Zaphod", _
NoReset:=False, _
Type:=wdAllowOnlyFormFields
End If
End Sub
("lets") and have an option of OK or Cancel. The sytnax below works fine if
the user will select OK on dialogue box but an error will occur if it select
Cancel as there is no document open. So, no document to protect. Can you
please help me how will I get out with this.
Public Sub MAIN()
'Unprotect the document if protection not already disabled
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="Zaphod"
End If
WordBasic.call "lets"
'Protect the document if protection not already enabled
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Password:="Zaphod", _
NoReset:=False, _
Type:=wdAllowOnlyFormFields
End If
End Sub