Hi guys....
What I'd like to achieve is to have a calling module (let's call it FROMModule), and a called module (lets call it TOModule), and in FROMModule to set up the name of a Public Variable, and call TOModule with the name of the variable, and have TOModule determine the value of the variable who's name was passed.
It's probably simple, but I've now spent so long searching for a "how to" example I'm in danger of forgetting why I wantted to know in the first place!
Sample code would be something like -
Can anyone spare a moment to give me a clue?
What I'd like to achieve is to have a calling module (let's call it FROMModule), and a called module (lets call it TOModule), and in FROMModule to set up the name of a Public Variable, and call TOModule with the name of the variable, and have TOModule determine the value of the variable who's name was passed.
It's probably simple, but I've now spent so long searching for a "how to" example I'm in danger of forgetting why I wantted to know in the first place!
Sample code would be something like -
Code:
Dim OtherVal As String
Sub FROMModule()
Dim VarName As String
OtherVal = "Hello"
VarName = "OtherVal"
TOModule (VarName)
End Sub
Sub TOModule(txt As String)
Dim SomethingMagicHappensHere As String
'*
'** Get the VALUE of the Variable received as txt
'** into the variable SomethingMagicHappensHere. Like -
'** SomethingMagicHappensHere = somefunction(txt)
'*
Debug.Print "I want the next bit to say Hello - " & SomethingMagicHappensHere
End Sub