Question:
Based on code Andreas Killer previously provided to obtain the object of a given name of code (here), worksheet I wrote the following function to obtain the object of a given control name:
Function GetControlObject public (ByVal ControlName As String) as Control
Answer:
I've tested this and it works very well. MyControl does not return Null - what you see is that its value is returned as "". Try to put a text in the text box. For example, the value of "TextBox1 text", and you should see returned as the value in the place.
If you set a watch variable MyControl, you will see that it is not nothing, which indicates that a real object is returned.
HTH,
Eric
0 Comments