=> How to setup vars when a workbookopen event is launched?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top