ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   = How to setup vars when a workbookopen event is launched? (https://www.excelbanter.com/excel-programming/314314-%3D-how-setup-vars-when-workbookopen-event-launched.html)

hcova[_2_]

= How to setup vars when a workbookopen event is launched?
 
I need to setup some variables in my VBA code before the program starts. I
think one could to include this setup in the Workbook_Open event, before the
worksheet be loaded. How Can I do this? Second: does VBA support "Typed
Constants" like Delphi or C? For example I would like to initialize a global
(public) boolean var called FirstTime as True, so when the first macro code
starts running it has this True value by default.

Bob Phillips[_6_]

= How to setup vars when a workbookopen event is launched?
 
Create this variable in a standard code module

Public FirstTime As Boolean

In the Thisworkbook class modujle add

Private Sub Workbook_Open()
FirstTime = True
End Sub

--

HTH

RP

"hcova" wrote in message
...
I need to setup some variables in my VBA code before the program starts. I
think one could to include this setup in the Workbook_Open event, before

the
worksheet be loaded. How Can I do this? Second: does VBA support "Typed
Constants" like Delphi or C? For example I would like to initialize a

global
(public) boolean var called FirstTime as True, so when the first macro

code
starts running it has this True value by default.





All times are GMT +1. The time now is 05:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com