ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   variable calling in different modules. (https://www.excelbanter.com/excel-programming/280461-variable-calling-different-modules.html)

russell

variable calling in different modules.
 
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.

Vasant Nanavati

variable calling in different modules.
 
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.


"russell" wrote in message
...
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.




russell

variable calling in different modules.
 
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.


"russell" wrote in

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



.



All times are GMT +1. The time now is 01:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com