Save them in a range name, and retrieve them later. Make sure the variables
are declared as Public variables in a general module, and use something like
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Names.Add name:="myVar1", RefersTo:=myVar1
End Sub
Private Sub Workbook_Open()
myVar1 = Evaluate(ActiveWorkbook.Names("myVar1").RefersTo)
End Sub
'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Adam1 Chicago" wrote in message
...
How can I get my variables to keep their values when I close my Excel
file?
In other words, I have some Dim statements at the top of my code so the
variables keep their values while I run different sub routines; however,
when
I close and re-open the file, the values are lost -- is there a way to
save
them?
(As you can probably tell, I am a novice so your not missing anything --
this is probably a very easy question.)
Thanks
|