Debug code in workbook open or activate events
Clara,
To debug the workbook open event, you can use the Stop statement at the
point where you want to start debugging. For example:
Private Sub Workbook_Open()
Stop 'this will suspend code execution and open the debugger. like
setting a breakpoint.
'your code here..
MsgBox "Hello, World"
End Sub
Save and close the workbook. Then re-open it. When the workbook open code
executes, it will suspend execution at the point where you put the Stop
statement and take you to the VBE.
To debug the activate event, you can use breakpoints. In the VBE, put the
cursor on the line of code where you want to start debugging, then press F9.
Go to the Excel application window and switch to a different workbook then
back again to the one you want to debug and it will trigger the activate
event.
--
Hope that helps.
Vergel Adriano
"clara" wrote:
Hi all,
How can debug code in workbook open or activate event
Clara
--
thank you so much for your help
|