E
Eric_G
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?
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?