Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Mmay Mmay is offline
external usenet poster
 
Posts: 2
Default protected form text boxes

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?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default protected form text boxes

You will need to include the following lines of code in your macro

ActiveDocument.Unprotect

' your code

ActiveDocument.Protect wdAllowOnlyFormFields

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Mmay" wrote in message
...
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?



  #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.
  #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.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open text boxes, only, in a protected document spooze27 Microsoft Word Help 1 July 26th 07 02:00 PM
How do i keep text boxes open in a protected form or document? wiggins Microsoft Word Help 1 March 9th 05 10:19 AM
Form is protected w/check boxes-Macbutton dofieldclick field also. yseto Microsoft Word Help 1 March 8th 05 08:38 PM
Retain editable images and allow text boxes in a form PW protected Shannon Microsoft Word Help 2 December 8th 04 03:37 PM
Text boxes in protected Doc, form fields BP522 Microsoft Word Help 5 December 3rd 04 07:55 PM


All times are GMT +1. The time now is 09:00 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"