Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Programatically Invoke "Debug"
Is there a way to halt the execution of a program or macro and invoke
debug via the code? Regards Greg |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Programatically Invoke "Debug"
Use Stop.
If sInput = "No" Then Stop John Green Sydney Australia "Greg Glynn" wrote in message oups.com... Is there a way to halt the execution of a program or macro and invoke debug via the code? Regards Greg |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Programatically Invoke "Debug"
Greg,
You can use either Stop Debug.Assert False 'Or some condition like Debug.Assert MyBoolean As these are in code, they remain between close/open of the file. Setting break points (left click, level with an executable line of code) on the left border of the code pane, so you get the line highlighted (the default colour being red). Breakpoints a removed when the file is closed. NickHK "Greg Glynn" wrote in message oups.com... Is there a way to halt the execution of a program or macro and invoke debug via the code? Regards Greg |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Programatically Invoke "Debug"
Greg,
You can use the Stop statement. This will pause the code and bring up the VBA Editor. Better yet is Debug.Assert (Condition) where Condition is any VBA expression that returns True (or any non-zero result) or False (or 0). If Condition is True or not equal to 0, Debug.Assert does nothing. If Condition is False (or 0), execution will pause on that line of code and open the VBA Editor. The advantage of Debug.Assert is that the break is conditional -- you can cause the code to break on Debug.Assert under only specific conditions, such as a variable being uninitialized. Stop is not conditional. It will always pause the code. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Greg Glynn" wrote in message oups.com... Is there a way to halt the execution of a program or macro and invoke debug via the code? Regards Greg |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Programatically Invoke "Debug"
Excellent.
Many thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I invoke running a macro from within an "IF" function. | Excel Worksheet Functions | |||
invoke "Save Changes?" prompt | Excel Programming | |||
How to handle "Invalid Worksheet Name" error programatically in VB | Excel Programming | |||
Debug.Print "Test " vbCodeLineNumber & ": " & varName | Excel Programming | |||
debug.print range "full" address | Excel Programming |