variable calling in different modules.

  • Thread starter Thread starter russell
  • Start date Start date
R

russell

Howdy all.
I have some macro's with defined variables in the
ThisWorkbook module, and normal modules Module1 and
Module2.

All macro's are private so users can't select a macro and
run it, for security/corporate reasons.
Is there a way to reference a variable which has been
defined in Module1 and Module2 from ThisWorkbook?
I.e.
Module1:
Private Sub GInfo1
strGVar = "78982.553896.013"
End Sub
Module2:
Privaate Sub GInfo2
strGVar2 = ".00000.1258.0"
End Sub
ThisWorkbook:
Private Sub InfoComb
strGString = strGVar & strGVar2
End Sub

Cheers and thanks
Russell.
 
Hi Russell:

Module1:

Public strGVar As String

Private Sub GInfo1
strGVar = "78982.553896.013"
End Sub

Module2:

Public strGVar2 As String

Private Sub GInfo2
strGVar2 = ".00000.1258.0"
End Sub

ThisWorkbook:

Private Sub InfoComb
Dim strGString As String
strGString = Module1.strGVar & Module2.strGVar2
End Sub

Regards,

Vasant.
 
Cheers mate.
Thats a big help!
-----Original Message-----
Hi Russell:

Module1:

Public strGVar As String

Private Sub GInfo1
strGVar = "78982.553896.013"
End Sub

Module2:

Public strGVar2 As String

Private Sub GInfo2
strGVar2 = ".00000.1258.0"
End Sub

ThisWorkbook:

Private Sub InfoComb
Dim strGString As String
strGString = Module1.strGVar & Module2.strGVar2
End Sub

Regards,

Vasant.





.
 
Back
Top