LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Code termination resets public variable

A variable, boolRenameSheets, is declared in a module at the module (General)
level. Speudo Code is below with the important declarations...

boolRenameSheets is being Watched (Break When Value Changes); the code never
breaks after modPublicMacros.runSimulationQuestion has begun.

Thank you all in advance for helping me with this conundrum.


Here is the process...

A) Set boolRenameSheets = True (occurs when ribbon is first accessed (ie
open workbook) and when checkbox is ticked) this module the only place that
contains 'boolRenameSheets ='. elsewhere "if boolRenameSheets then" is
used... this make it very evident the my code does not change
boolRenameSheets.
B) ReDimensions (not-preserve by design) populates some arrays
C) Runs code in a DLL that uses the arrays
D) deletes sheets meeting a specified criteria
E) creates new sheets and populates cells on these sheets
F) MsgBox indicating the process completed (and also boolRenameSheets)

THIS IS WHAT HAPPENS:
0 - ribbonCallBacks.cbSetRenameSheets) Set boolRenameSheets = True using the
ribbon

1 - modPublicMacros.runSimulationQuestion) Run the special code...

2 - modSpecialCode.runSimulation) Display boolRenameSheets immediately
before code execution stops
boolRenameSheets = True

3 - Immediate Window) Use the immediate window to verify boolRenameSheets
immediately after step 2 finishes
? boolRenameSheets
False



_________________________________________________
'modPublicMacros

Option Compare Binary
Option Explicit
Option Base 0

Public boolPrintDerivatives As Boolean
Public boolRenameSheets As Boolean

Public Sub runSimulationQuestion
'Pseudo Code....
if msgBox() = vbYes Then modSpecialCode.runSimulation
End Sub

_________________________________________________
'ribbonCallBacks

Option Private Module
Option Compare Binary
Option Explicit
Option Base 0

'Callback for chkRenameSheets getPressed
Public Sub gpRenameSheets(ByVal control As IRibbonControl, ByRef returnedVal)
'Set default value to True
returnedVal = True
boolRenameSheets = True
End Sub

'Callback for chkRenameSheets onAction
Public Sub cbSetRenameSheets(ByVal control As IRibbonControl, ByVal pressed
As Boolean)
'Set value to checkbox value
boolRenameSheets = pressed
End Sub

_________________________________________________
'modSpecialCode

Option Private Module
Option Compare Binary
Option Explicit
Option Base 0

Public Sub runSimulation()
runSimulationPartA
End Sub


Private Sub runSimulation
deleteSheets
GetInput
runSimulationDLL
populateOutput
MsgBox boolRenameSheets & " complete" 'Shows true when
runSimulationPartA begins execution with boolRenameSheets = true
End Sub


Private Sub deleteSheets
'delete old sheets
End Sub


Private Sub GetInput
'populate arrays
End Sub


Private Sub runSimulationDLL
'Execute the dll
End Sub


Private Sub populateOutput
'create new sheets
End Sub


 
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
Public Variable Marvin Excel Programming 1 March 29th 07 09:50 PM
Public variable Eric[_35_] Excel Programming 7 March 18th 07 06:54 AM
Public variable Jack New Users to Excel 4 March 18th 06 09:35 PM
Public Variable Jason Excel Programming 4 April 12th 04 07:06 PM
public variable marwan hefnawy Excel Programming 1 September 5th 03 08:54 AM


All times are GMT +1. The time now is 05:43 PM.

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"