Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passig a variable from one module to another
I am attempting to pass a variable value from one module to another module in
another worksheet. I first collect the values based on user input in macro 1and then call macro2 from my "PERSONAL.xls" file to continue processing. Unfortunately, I need to capture some of the data which was used in the first macro and pass it along to the 2nd macro. I've declared the variables "up top" as follows: Option Explicit Public xlfile_drive As String Public period_end As String Public open_file As String Public open_file_name As String Public continueprompt As String Sub Create_Return_File(xlfile_drive, period_end, open_file, open_file_name, continueprompt) periodend = InputBox("Enter reporting month-end in this sample format: 2007-Aug") xlfile_drive = "T:\mktg\star keystone reporting\Keystone\" & periodend & "\" ChDir xlfile_drive open_file_name = "ROR Series ATC and Models Report-" & Right(periodend, 3) & "-" & Mid(periodend, 3, 2) & ".xls" open_file = xlfile_drive & open_file_name .... Further down, I then call the 2nd macro as follows: Call Add_EPL_Data .... Public Sub Add_EPL_Data(open_file_name, open_file) Application.Run "'Personal.xls'!Add_EPL_Returns" End Sub Still, the macro is not working and is giving me the error message: Compile error -- variable not defined. I had thought, however, that defining it at the global level outside the subprocedure would resolve this problem? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Read Variable from Another Module | Excel Programming | |||
STATIC VARIABLE NOT AVAILABLE IN ANOTHER MODULE | Excel Discussion (Misc queries) | |||
How to Set a Variable in Another Module? | Excel Programming | |||
Variable in more than one module | Excel Programming | |||
Variable from a sheet module in a class module in XL XP | Excel Programming |