Forum Discussion

adrian_g's avatar
adrian_g
Occasional Contributor
14 years ago

Is there a way to access variables across different script units w/out using proj vars?

Hi All,



Is there a way to access variables across different script units without using project variables?



I can easily pass variables in and out of different subroutines in the same script unit with no hassle but I’m not aware how to do this without using project variables.



BTW I'm using VB Script.



Thanks,

Adrian

1 Reply

  • adrian_g's avatar
    adrian_g
    Occasional Contributor
    Figured it out:





    UNIT1 script contents:


    'USEUNIT Unit2


    public sMessage1


    Sub sSampleSub1


      sMessage = "Hello"


      sSampleSub2


    End Sub


    UNIT2 script contents:


    'the below line HAS TO BE here otherwise it wont work

    'USEUNIT Unit1        


    Sub sSampleSub2


      msgbox sMessage


    End Sub