K
kill_beast
I posted this once, but it was messy and I kept replying to myself, so I'm
just marking that one as answered and rewriting.
I have a Word document with Form Field protection. It has code for both
Document_Close and Document_Open.
Both use this to turn off and turn back on the protection:
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If
....and then...
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True,
Password:=""
In between these statements, I have some code that attempts to change the
font of some form fields, but for some reason, the Document_Open sub
procedure doesn't work, specifically because it says that form protection is
on, but only during the actual open event. If I manually run it after the
document is already open, it works fine. Using message boxes, I was able to
determine that the Document_Open procedure is actually running when I open
the document, but it acts as if it's ignoring the piece of code that
unprotects the form.
What could be the reason for this? It is really odd that this unprotect
code only fails during the open event, and by fail I don't mean it returns an
error (the code attempting to change the fields complain about protection
still being on), but it just seems like it skips right over it.
Any ideas?
Thanks!
just marking that one as answered and rewriting.
I have a Word document with Form Field protection. It has code for both
Document_Close and Document_Open.
Both use this to turn off and turn back on the protection:
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If
....and then...
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True,
Password:=""
In between these statements, I have some code that attempts to change the
font of some form fields, but for some reason, the Document_Open sub
procedure doesn't work, specifically because it says that form protection is
on, but only during the actual open event. If I manually run it after the
document is already open, it works fine. Using message boxes, I was able to
determine that the Document_Open procedure is actually running when I open
the document, but it acts as if it's ignoring the piece of code that
unprotects the form.
What could be the reason for this? It is really odd that this unprotect
code only fails during the open event, and by fail I don't mean it returns an
error (the code attempting to change the fields complain about protection
still being on), but it just seems like it skips right over it.
Any ideas?
Thanks!