Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can't start a sub with an argument using F8.
However, if you set a breakpoint at the first statement in the macro and choose Save from the workbook, you'll be dumped into the VBE and you can step with F8. In article , "Hari" wrote: 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 ? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Only step through cells that are "Active" | Excel Programming | |||
"Multiple-step operation generated errors" | Excel Programming |