View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default protected form text boxes

On Thu, 13 Mar 2008 09:19:01 -0700, Mmay wrote:

I have created an online application for employment with text boxes and check
boxes. I need for my text boxes to appear in a different font color after
they have been filled in or tabbed through. I can create a macro to perform
this on exit, but it does not work once the document is protected (i receive
a run time error). Is there any way that I can do this through a macro, or
any better way to change the font color?


In order for the macro to do its job in a protected form, it needs to start by
unprotecting the document; after it changes the color, then it can reprotect the
document. A "skeleton" of the code looks like this:

If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect
End If

' do the work here

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

If the form protection has a password, that can be added to both the .Unprotect
and .Protect statements.

If you have further questions about this, please post in one of the Word VBA
groups such as
http://www.microsoft.com/office/comm...ba.beginner s

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.