davidboutche
08-10-2009, 03:18 AM
I have a series of user forms that call different procedures using different aspects of office.
The very final thing I want to happen is for the word document that has been created from a template to be protected to stop changes to it.
I made this procedure that I placed in a module:
Sub formprotect()
'
Checkerdoc.Activate
activedocument.Protect Password:="qwerty", NoReset:=False, Type:= _
wdAllowOnlyFormFields
End Sub
I thought that I had set the variable when the first user form initialised and made it available to all procedure by calling using the sub:
Sub UserForm_Initialize()
Dim Checkerdoc As Document
Set Checkerdoc = ActiveDocument
'.....and so on...
When I run the complete program it returns the error 'object required'
I'm assuming it doesn't know what the activedocument is to protect?
The very final thing I want to happen is for the word document that has been created from a template to be protected to stop changes to it.
I made this procedure that I placed in a module:
Sub formprotect()
'
Checkerdoc.Activate
activedocument.Protect Password:="qwerty", NoReset:=False, Type:= _
wdAllowOnlyFormFields
End Sub
I thought that I had set the variable when the first user form initialised and made it available to all procedure by calling using the sub:
Sub UserForm_Initialize()
Dim Checkerdoc As Document
Set Checkerdoc = ActiveDocument
'.....and so on...
When I run the complete program it returns the error 'object required'
I'm assuming it doesn't know what the activedocument is to protect?