View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
rogge rogge is offline
external usenet poster
 
Posts: 11
Default Code termination resets public variable

As i study this issue today, my "fix" to the non-trappable "<application
error" still occurs. This is my fix..

For i = wkbActive.Worksheets.Count To 1 Step -1
If (wkbActive.Worksheets(i).CodeName Like strDeleteSheet & "*") Then
Debug.Print "before " & boolRenameSheets
wkbActive.Worksheets(i).Delete
Debug.Print "after " & boolRenameSheets
End If
Next i

Ok, this is NOT where boolRenameSheets is reset. I ran the code
back-to-back after setting boolRenameSheets to True... Here is the output
from the code.

before True
after True
before False
(watch causes break)
after False

The watch causes code to break on the line: Debug.Print "after " &
boolRenameSheets as indicated above. HOWEVER, the value did not change.

Does this help any one help me? <shakes his cloudy head


"Dave Peterson" wrote:

I don't know anything about the ribbon.

Maybe someone else will jump in.

rogge wrote:

No instances of "End" exist. (no one here had tough of that, thank you for
this tip).

Here is the last part of "Private Sub runSimulation"
...
...
...
' Clear variables declared by solomonrunSPSLFeed
xlCalcType = Empty

' Error handler
On Error GoTo 0: MsgBox "A) " & boolRenameSheets & vbTab &
boolPrintDerivatives: Exit Sub

runSPSL_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
runSPSL of Module modSpyroSPSL", vbCritical + vbOKOnly, "Error"

End Sub

When the whole process begins with boolRenameSheets set to True, the message
box shows:
"A) True"

So I *know* that boolRenameSheets has kept the value up until this dialog
box is displayed. After "OK" is clicked; boolRenameSheets returns false in
the immediate window.

(Can one access the check box i have in the ribbon? maybe I can get its
value rather than use boolRenameSheets.)

"Dave Peterson" wrote:

I don't know about the ribbon, but does any of your code use End (not End Sub,
End Function, End if), just plain old End.

This will reset those variables.


--

Dave Peterson