![]() |
Ignore breakpoint when running a macro
When troubleshooting a macro, there are instances where I want to switch back
and forth between running and debugging. There are breakpoints in my debugging, which I find I must remove before running to prevent interruption in execution. Then, when I go back to debugging I need to reinsert them. How can I tell Excel to ignore breakpoints when running (without deleting them, so that I may use the same breakpoints for future debugging)? Thanks. |
Ignore breakpoint when running a macro
I don't think such a thing is possible, what i do is where my breakpoints
are, i go to Edit-Bookmarks and toggle bookmark, this will create a mark by that line of code, put those on your breaks and run, then you can go to next or previous bookmarks and put breaks on the ones you want. If you right click and customize your toolbar, you can put them right on your toolbar and its very easy. -- -John Please rate when your question is answered to help us and others know what is helpful. "hmm" wrote: When troubleshooting a macro, there are instances where I want to switch back and forth between running and debugging. There are breakpoints in my debugging, which I find I must remove before running to prevent interruption in execution. Then, when I go back to debugging I need to reinsert them. How can I tell Excel to ignore breakpoints when running (without deleting them, so that I may use the same breakpoints for future debugging)? Thanks. |
Ignore breakpoint when running a macro
Use conditional compilation.
Add a constant declaration at the start of the module like #Const InDebug = True Then in your code add statements like #If InDebug Then Stop #End If your code will stop at those points. When you want to stop debugging, just change the True to False. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "hmm" wrote in message ... When troubleshooting a macro, there are instances where I want to switch back and forth between running and debugging. There are breakpoints in my debugging, which I find I must remove before running to prevent interruption in execution. Then, when I go back to debugging I need to reinsert them. How can I tell Excel to ignore breakpoints when running (without deleting them, so that I may use the same breakpoints for future debugging)? Thanks. |
Ignore breakpoint when running a macro
Hmm,
don't worry about this being Word code. Sub Test9987() Dim Mystop As Boolean '! Mystop = False ' disable breaks Selection.GoTo _ what:=wdGoToPage, _ which:=wdGoToAbsolute, _ Count:=1 If Mystop Then Stop '! Selection.GoTo _ what:=wdGoToPage, _ which:=wdGoToAbsolute, _ Count:=3 End Sub -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Vista Small Business, Office XP |
Ignore breakpoint when running a macro
Not sure, Helmut, I understand what the code does, or how to implement it.
Can you explain it? Thanks. "Helmut Weber" wrote: Hmm, don't worry about this being Word code. Sub Test9987() Dim Mystop As Boolean '! Mystop = False ' disable breaks Selection.GoTo _ what:=wdGoToPage, _ which:=wdGoToAbsolute, _ Count:=1 If Mystop Then Stop '! Selection.GoTo _ what:=wdGoToPage, _ which:=wdGoToAbsolute, _ Count:=3 End Sub -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Vista Small Business, Office XP |
Ignore breakpoint when running a macro
Hi hmm,
Not sure, Helmut, I understand what the code does, or how to implement it. Can you explain it? Thanks. That was probably too simple. I define a boolean variable "myStop". If I want the code to stop, I set "myStop" to true, like Sub Test9987() Dim Mystop As Boolean '! Mystop = True ' your Excel code goes in here if myStop then stop ' more Excel code goes in here if myStop then stop ' more Excel code goes in here End sub If myStop is true then the sub stops at every line "if myStop then stop" If myStop is false, which is the default value, then the code doesn't stop at all. You may even define different boolean variables or an array of booleans, in order to stop only at certain lines, like: Sub Test9987A() Dim Mystop1 As Boolean '! Dim Mystop2 As Boolean '! Mystop1 = True ' your Excel code goes in here if myStop1 then stop ' more Excel code goes in here if myStop2 then stop ' more Excel code goes in here End sub which will stop only at "if myStop1 then stop" HTH -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Vista Small Business, Office XP |
All times are GMT +1. The time now is 03:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com