
Originally Posted by
CVDpr
i want to msgbox the textbox.text that has the tag "low"
Try this then:
Code:
Option Explicit
Private Sub Command1_Click()
Dim myText As String
myText = GetText("Text1", "low")
MsgBox myText
End Sub
Public Function GetText(myName As String, myTag As String) As String
Dim txt As Control, myText As String
For Each txt In Me.Controls
If TypeOf txt Is TextBox And LCase(txt.Name) = LCase(myName) Then
If LCase(txt.Tag) = LCase(myTag) Then
myText = txt.Text
Exit For
End If
End If
Next txt
GetText = myText
End Function