Hi all! I am working on a macro and I want to be able to pass the values of severable variables (these are mostly file paths... so variables are As String) from the first Sub into the other Subs in the module. I thought if I defined them as Public at the beginning, that would do the trick, but it seems like that does not pass any stored values for the variables.
I've tried placing the variables as arguments between the brackets of the second Sub and that works, but only if I call the Step_2 Sub from the first Sub, which isn't ideal as I don't want the Step_2 Sub to start immediately... I would like the User to be able to initiate the Step_2 Sub whenever they are ready and just have the variables from Step_1 available in Step_2 (and additional subs in the module) so that I don't have to redefine them for each Step.
Can anyone shed some light on what I'm doing or not doing and why?
Thanks,
Joe
__________________________________________________________________
I've tried placing the variables as arguments between the brackets of the second Sub and that works, but only if I call the Step_2 Sub from the first Sub, which isn't ideal as I don't want the Step_2 Sub to start immediately... I would like the User to be able to initiate the Step_2 Sub whenever they are ready and just have the variables from Step_1 available in Step_2 (and additional subs in the module) so that I don't have to redefine them for each Step.
Can anyone shed some light on what I'm doing or not doing and why?
Code:
Option Explicit
Public FldrRoot As String
Public AMDExt As String
Public PAABMgmt As String
Public Jones As String
Public FRep As String
Public CYPVS As String
Public PYPVS As String
Public INDatt As String
Public IMA As String
Sub Step_1()
'//Does some work and ends with...
MsgBox ("Step 1 is complete! Please save required reports in the designated locations and click the next Step")
Step_2 AMDExt, PAABMgmt, Jones, FRep, CYPVS, PYPVS, INDatt, IMA
End Sub
Sub Step_2(AMDExt As String, PAABMgmt As String, Jones As String, FRep As String, CYPVS As String, PYPVS As String, INDatt As String, IMA As String)
''?? I would like to send these variable values from Step_1 sub to steps 2 and 3 subs, but i want the user to initiate these subs when they are
' ready by clicking a button in the workbook.
Thanks,
Joe
__________________________________________________________________
Mod edit : post moved to appropriate forum …