Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling name of Sheet as a Variable? thekeytothedoor Excel Worksheet Functions 1 January 1st 10 08:48 AM
Calling a procudure through variable name Basu Excel Discussion (Misc queries) 2 August 30th 06 08:55 AM
Scope of variable includes all Form _and_ Code modules?? John Wirt[_2_] Excel Programming 5 August 18th 03 08:27 AM
saveas calling a variable Douvid Excel Programming 6 July 28th 03 08:46 AM
Using the same variable in separate userform modules DarrenW Excel Programming 2 July 11th 03 03:11 AM


All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"