Thread: Variable Scope
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Variable Scope

At the top of a standard module outside any procedure

Public Myvar as Variant
Public MyString as String

for example.

then in the workbook_open event in the ThisWorkbook Module

Private Sub workbook_Open()
Myvar = 21
MyString = "Today is " & format(date,"mm/dd/yyyy")

End Sub

--
Regards,
Tom Ogilvy

"Kevin" wrote in message
...
How do I set variables that will remain in scope as long
as my application is open. I need to set several variables
that I need to access (and possibly modify) at any time
after it is initially set while my application is open.

Help here would be greatly appreciated!

Thanks!

Kevin