As described in the previous post, once defined a public variable and assigned it to a funcion, we are able to use it in a number of different tasks. The trick is the same one, obviously! ;)
Follow these steps:
1) declare into a module the variable as public:
Public MyString As String
2) create a function with an arbitrary name and assign to the function's name the desired value
Public Function CallMyString()
CallMyString = MyString
End Function
3) use the function's name as value or as a part of a string:
CallMyString()
For Instance we could have a text box onto a form called textbox2. Let's assign to the textbox a string value:
form_nameform.textbox2.value = "An arbitrary string " & CallMyString()
Follow these steps:
1) declare into a module the variable as public:
Public MyString As String
2) create a function with an arbitrary name and assign to the function's name the desired value
Public Function CallMyString()
CallMyString = MyString
End Function
3) use the function's name as value or as a part of a string:
CallMyString()
For Instance we could have a text box onto a form called textbox2. Let's assign to the textbox a string value:
form_nameform.textbox2.value = "An arbitrary string " & CallMyString()