Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
hmm hmm is offline
external usenet poster
 
Posts: 175
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.programming
hmm hmm is offline
external usenet poster
 
Posts: 175
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
breakpoint calculation John C[_2_] Excel Worksheet Functions 0 October 22nd 08 02:27 PM
Find used range and ignore blank cells when running macro? Rick S. Excel Programming 3 October 3rd 07 02:52 PM
breakpoint affecting the run speed of a macro kebabb Excel Programming 3 December 2nd 06 05:17 AM
Breakpoint ok, no breakpoint messes up... Vikxcel[_8_] Excel Programming 0 January 4th 06 09:18 PM


All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"