View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Hari[_3_] Hari[_3_] is offline
external usenet poster
 
Posts: 157
Default Not able to "Step in" - Debug

Hi Troy and JE M

Thanx a lot for ur help. Im able to pin down the error.

Regards,
Hari
India


"TroyW" wrote in message
...
Hari,

Another method is to insert the command "Stop" in the code. When the
program encounters the Stop command it will halt execution and place you
into debug mode waiting for you to use F8 to continue executing the

program
line-by-line. Of course, you would want to remove "Stop" from your code
after you're done debugging.

You can also do fancy things like using a variable to turn on and off the
debug code. You can declare a Public Boolean variable that turns on and

off
all of your lines of debug code. In the example below, I've created a
boolean named: PbDebugOn

At the beginning of the code you would set the variable True.
PbDebugOn = True

Then lines like the one below would evaluate True and stop your code in
debug mode.
If PbDebugOn = True and iCount 100 then Stop

Troy


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Stop '''Code will stop and wait.
'''The rest of your code below.

End Sub

"Hari" wrote in message
...

Hi,

I have a Sub Workbook_BeforeSave. (This sub further calls another

Function)

The file doesnt save if there are any inconsistency within the file's

data
and flags the errors with a yellow fill color.

I have inputted correct data but the file is not saving and giving a

message
that one particular cell has incorrect data and has filled it with

yellow
color.

Now, I want to run this sub by stepping in to it ( step by step with

F8 )so
that I get a better understanding of why it is happening.

But in VB when I choose Workbook_beforesave and press F8, nothing

happens.

Where am I going wrong ?

Regards,
Hari
India