variable calling in different modules.

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.
 
V

Vasant Nanavati

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.
 
R

russell

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.





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top