Word VBA: -- Fire event on leaving a table's cell -- LostFocus? Keypress? AutoText?
Posted on 2003-03-13
Something for true VBA gurus:
I have a table in my Word document with various data in it:
NAME: Joe Shmoe
FILE NUMBER: 123456789
DATE: March 13, 2003
The user fills in the data in the table. What my boss wants (i.e....demands) is that if the user plugs in a date such as 03/13/2003 then the computer will automatically standarize it as March 13, 2003. In addition, if file number (SSN) is entered as 123-45-6789, I need it to change to 123456789. I have written macros that do this but I need to find out how i should fire these.
Ideally, Word should fire it automatically after the user moves away from that cell (like a lostfocus kinda thing). If it isn't possible, my alternatives are to execute it on save (w/ a notification to the user), execute it on print, have a "Validate" button, etc. Also, I am trying to avoid putting a textbox object on the form. The end-users are not the brightest when it comes to Word/PCs.
Another idea I had was to fool around with AutoText - which begs the question of how AutoText works. Word constantly checks what we type...but how...just curious.