Resting Anchor

The Anchorage

Personal website of Gregory K. Maxey, Commander USN (Retired)

Table Cell Events
(A Microsoft Word Help & Tip page by Gregory K. Maxey)

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

However, the work is mine. 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 PayPal. Thank you!


This Microsoft Word Tips & Microsoft Word Help page demonstrates a method that you can use to create "custom" table cell "OnEnter, OnChange and OnExit" events using VBA procedures.   You can download a demonstration document using the link at the end of the page.

While the examples I show here may appear simplistic, implementing this method in a practical application requires extensive planning, thought and work; and a fairly good understanding VBA. I feel that the potential benefit of real time evaluation of user entered data in certain applications may be worth the extra time, thought and effort.

Before going any further I want to give some credit where credit is due. The "master key" to the entire method is a relatively simple (now simple to me at least) procedure to monitor a range object for change. I was introduced to that method by Jeff Vandervoort and first applied it in my Content Control Custom Events tips page. Jeff participates in the Microsoft Office Word for Developers forum and without his skills and his willingness to share the fruits of those skills this tips page would not be published. I would also like to thank Jason Frost Simpson, a regular in the VBA Express forum, for suffering eye strain to read my unconventionally structured code and providing valuable suggestions for improvement.

Meet the Events

The cell events are defined as follows:

For the demonstration I will be using a Word 2010 document containing three tables.

Site Note IconNote. The illustrations in this tips page may or may not reflect the appearance or arrangement of the actual demonstration document.

The first demonstration utilizes a singe cell table and illustrates all three events.

table cell events 1
table cell event 2
table cell event 3

table cell event 4
table cell event 5

The basic demonstration should illustrate a solution to a common request. "How can I limit the amount of text a user can enter into a table cell?"  You will of course have to change the action on each event to suit your particular need.

In Table 2 below:

table cell event 6

With thought and planning you can take advantage of the events to perform real time processing of data user enter into table cells. Table 3 below illustrates a small excerpt from a invoice template that I have developed. Calculation are performed automatically in real time as the user changes quantity or price.

table cell event 7

You can download the complete demonstration document here: Table Cell Change Events Demo

That's it! I hope you have found this tips page useful and informative.

Share

PAYMENTS/DONATIONS

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

Do you want to make a payment for consulting work or donate to help support this site?

PayPal is a safe, easy way to pay online.

Use the appropriate currency "Donate" button to make a payment or donation.


Search my site or the web using Google Search Engine

Google Search Logo