PC Review


Reply
Thread Tools Rate Thread

Cannot debug

 
 
=?Utf-8?B?RW1pbHkgRWRnaW5ndG9u?=
Guest
Posts: n/a
 
      9th Apr 2007
I have a procedure that will not respond when I try to step through or run to
cursor. However, some procedures within the same module will respond to
debugging. I know that you cannot step through worksheet change events, etc,
but these procedures are in a normal module. Are there procedures you cannot
step through?
 
Reply With Quote
 
 
 
 
Bob Umlas
Guest
Posts: n/a
 
      9th Apr 2007
You CAN step through worksheet change events or any code. It's not clear why
you're having a problem, but perhaps you can put a breakpoint in the code to
force the single-step when it gets to that breakpoint line -- click on the
line of code, then press F9, then run the macro the usual way. When it gets
to the breakpoint line you'll be in step mode.
Bob Umlas
Excel MVP

"Emily Edgington" <(E-Mail Removed)> wrote in
message news:FD7D3C1A-D9E9-485D-8A2C-(E-Mail Removed)...
>I have a procedure that will not respond when I try to step through or run
>to
> cursor. However, some procedures within the same module will respond to
> debugging. I know that you cannot step through worksheet change events,
> etc,
> but these procedures are in a normal module. Are there procedures you
> cannot
> step through?


 
Reply With Quote
 
=?Utf-8?B?RW1pbHkgRWRnaW5ndG9u?=
Guest
Posts: n/a
 
      9th Apr 2007
I found that if I remove the variable declaration in the Sub line, I can step
through. So I changed:

Sub ChangeSource(Optional intFileID As Integer)

to

Sub ChangeSource()

and I can step through or run to cursor to my heart's content. I guess that
is the reason I thought I couldn't step through worksheet change events - I
always have them set up with variable declarations in the Sub line (for all I
know, that's the only way).

Is this normal (that you can't step through with variables in the Sub line),
or a weirdness in my Excel (2000 on WinNT)?



"Bob Umlas" wrote:

> You CAN step through worksheet change events or any code. It's not clear why
> you're having a problem, but perhaps you can put a breakpoint in the code to
> force the single-step when it gets to that breakpoint line -- click on the
> line of code, then press F9, then run the macro the usual way. When it gets
> to the breakpoint line you'll be in step mode.
> Bob Umlas
> Excel MVP
>
> "Emily Edgington" <(E-Mail Removed)> wrote in
> message news:FD7D3C1A-D9E9-485D-8A2C-(E-Mail Removed)...
> >I have a procedure that will not respond when I try to step through or run
> >to
> > cursor. However, some procedures within the same module will respond to
> > debugging. I know that you cannot step through worksheet change events,
> > etc,
> > but these procedures are in a normal module. Are there procedures you
> > cannot
> > step through?

>

 
Reply With Quote
 
Keith R
Guest
Posts: n/a
 
      10th Apr 2007
If you post your sub code, the group may give you better feedback on why
that declaration might have caused the original problem.

> I always have them set up with variable declarations in the Sub line (for
> all I
> know, that's the only way).


As someone who's never had the formal training to know better, I do the
opposite- I never set them up with variable declarations in the sub line,
with the infrequent exception of functions or subs where I absoloutely need
to pass data directly. I probably don't use it as often as I should (and
perhaps not correctly when I do), but I definitely wouldn't throw them in
unless you were intentionally going to pass a variable to that sub from a
calling procedure.

I look forward to reading some of the more expert replies on the subject.

HTH,
Keith


 
Reply With Quote
 
Norman Jones
Guest
Posts: n/a
 
      10th Apr 2007
Hi Emily,

'---------------
Is this normal (that you can't step through with variables in the Sub line),
or a weirdness in my Excel (2000 on WinNT)?
'---------------

As your macro has an argument (intFileID), you need to
call it from another procedure.


To step though your macro, try something like:

'=============>>
Public Sub Tester()
Call ChangeSource(intFileID:=5) '<<=== CHANGE
End Sub
'<<=============


---
Regards,
Norman


 
Reply With Quote
 
=?Utf-8?B?RW1pbHkgRWRnaW5ndG9u?=
Guest
Posts: n/a
 
      10th Apr 2007
When I said "I always have them set up with variable declarations", I was
speaking specifically of Worksheet Change Events. And the reason is because
I got the basic code from VBA Help files or some posting in the forum, etc.
and never felt comfortable making a change to it. For anything I wrote
myself (*cough*...or pasted together myself, if you will), I never use
variable declarations in the Sub line.

However, your suggestion is noted - I will try to remember to post the code
if it seems necessary or helpful.

"Keith R" wrote:

> If you post your sub code, the group may give you better feedback on why
> that declaration might have caused the original problem.
>
> > I always have them set up with variable declarations in the Sub line (for
> > all I
> > know, that's the only way).

>
> As someone who's never had the formal training to know better, I do the
> opposite- I never set them up with variable declarations in the sub line,
> with the infrequent exception of functions or subs where I absoloutely need
> to pass data directly. I probably don't use it as often as I should (and
> perhaps not correctly when I do), but I definitely wouldn't throw them in
> unless you were intentionally going to pass a variable to that sub from a
> calling procedure.
>
> I look forward to reading some of the more expert replies on the subject.
>
> HTH,
> Keith
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
random Microsoft Visual C++ Debug Library Debug Error =?Utf-8?B?ZGNobWFu?= Microsoft Access VBA Modules 1 26th Apr 2006 03:25 PM
How to tell if your C# code is running in debug mode (debug compil =?Utf-8?B?TWF4IE0uIFBvd2Vy?= Microsoft C# .NET 3 20th Oct 2005 10:39 PM
V Studio 2003 Doesn't Load Supporting DLL Debug Symbols for Windows Service Remote Debug INGSOC Microsoft C# .NET 0 8th Feb 2005 09:19 AM
Debug Error - Microsoft Visual C ++ Debug Library =?Utf-8?B?THVrZXN0ZXI0Mg==?= Microsoft Outlook VBA Programming 5 23rd Nov 2004 01:19 AM
Visual C++ Debug Library. Debug Error! Abnormal program termination John Microsoft Outlook Discussion 1 25th Sep 2004 09:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:22 AM.