View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Mmay Mmay is offline
external usenet poster
 
Posts: 2
Default protected form text boxes

Thank you, now my font color problem is solved. Now I am wondering if there
is any way to remove the shading from the text boxes and check boxes as they
are exited as well as change the font to black only when the text/check box
is edited. When I select the form field check box my vba editor says that my
item is not found?

"Jay Freedman" wrote:

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.