Validating in a web user control

6854933580_2c8b688306_z

DISCLAIMER/TERMS OF USE The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access Pay Pal. his Microsoft Word Tips & Microsoft Word Help page introduces and demonstrates a method that you can use to create "custom" content control "On Enter, On Change and On Exit" events using VBA procedures.

While the built-in Document_Content Control On Enter and Document_Content Control On Exit events have improved with the release of Word2010, there remains a persistent bug in the Word2007 On Exit event.

Using this method, you can avoid that bug and any text or changes that your document users make in content controls can be evaluated and processed in real time, thus eliminating the need for the document user to first "exit" a content control.

Before going any further I want to give some credit where credit is due. Jeff participates in the Microsoft Office Word for Developers forum.

Without his skills and his willingness to share the fruits of those skills, this tips page would still be unpublished and gathering dust.

Ever since content controls were introduced in Word 2007 I have wondered over , sought after , and frequently groused about why Microsoft has failed to provide a built-in "Document_Content Control On Change" event.

While I was wondering and grousing, Jeff devised a relatively simple VBA procedure that continually monitors the active content control's range and when any change occurs triggers a call to another procedure that can evaluate and process the change.

The pseudonym is all I have in the case of Hans V, but both assisted in this effort with solutions to several nagging problems in the code.At the time of this writing Jeff's procedure is unpublished and part of a larger custom application that he is developing.With Jeff's concurrence I have expanded the scope of his monitoring procedure to detect and trigger custom On Enter and On Exit events.Jeff says that his "baby sub-routine" appears "all grown up" in the solution demonstrated here.I say thank you Jeff for sharing your baby with me!!For the discussion, I'm using a Word 2010 document containing content controls as shown in the following illustration.

You must have an account to comment. Please register or login here!