Share via

Highlight Date fields and content controls until updated

Anonymous
2015-09-09T12:47:20+00:00

I am building a MS Words template to share with my team and the footer includes:  Copyright Year, creation Month and Year, and placeholder text for registered products.  I'm using Quick Part fields for the two dates and rich text content control for the registered marks.  For the date fields, I would like for the text to be highlighted yellow until they click <Update>, which will cause the highlight to disappear.  Same with the content control.  I would like the placeholder text to be highlighted yellow until they enter the field, in which case the highlight will disappear.

Is this possible?  Thank you for your help!

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

Answer accepted by question author

Paul Edstein 82,861 Reputation points Volunteer Moderator
2015-09-10T04:51:04+00:00

Yes, it's possible, but that also means using a macro-enabled document so you can use a macro to toggle the highlighting. There is, however, no way you can force the document's users to allow the macro to run, which means the highlighting won't necessarily get removed once they update the content control.

Subject to the above, such macros might be coded as:

Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)

With CCtrl

  If .Range.Text = .PlaceholderText Then

    .Range.HighlightColorIndex = wdYellow

  Else

    .Range.HighlightColorIndex = wdNoHighlight

  End If

End With

End Sub

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful