Changing Form Field highlight and/or background color when document is protected

Anonymous
2016-01-25T19:46:47+00:00

Can it be done?

I am able to change the form field color programmatically, provided the document is not protected, but when not protected the document is much less useful as a form, because it is too easy for the user to accidentally delete the form field when entering data.

So, for instance, when the document is not protected, this works:

     ActiveDocument.FormFields(1).Range.HighlightColorIndex = wdBrightGreen

But when the document is protected, I get a run-time error.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Doug Robbins - MVP - Office Apps and Services 323.8K Reputation points MVP Volunteer Moderator
    2016-01-26T02:24:55+00:00

    When using FormFields, the document must be protected for filling in forms and while you can turn on the shading of the formfields, the only colour is grey.  The advantage of using that shading however is that it does not print,

    If you want to apply some other colour, you will have to run the macro before protecting the document and then protect it after running the macro.  Shading applied in that manner will be printed, unless you again unprotect the document and run a macro to remove it.

    Was this answer helpful?

    0 comments No comments