Debugging code in After Update property of a text box

M

Maggiesue111

When I initiate an event procedure and enter the VBA code I want to see it
run line by line but when I click in the code window and hit F8 nothing
happens. According to the way I read Microsoft Office Assistance at
http://office.microsoft.com/en-au/assistance/HA010428191033.aspx, I should be
able to step through the program a line at a time but when I hit F8 nothing
happens like it does when I follow their sample. Any suggestions on how I
can debug this rascal?
 
G

George Nicholson

That method works in the article because the DebugDemo procedure is a simple
Public sub (the default) with no arguments. Your AfterUpdate code is 1)
Private and 2) an event procedure so it won't respond to that method
(neither do Functions, which return values, or any procedure that requires
arguments).

You'll need to use the "Set Breakpoint" method and then get the code to run
so it encounters the breakpoint.
- Put your cursor somewhere in the first line of executable code in the
Event procedure, then hit F9 to add a breakpoint.
- Run the form and do whatever you need to do to trigger the AfterUpdate
event. You'll end up back in the VBE with your breakpointed line
highlighted (about to be executed).
- Now you can use F8 to step through the code.

HTH,
 
Top