So I have the following code that supposed to allow me to put a placeholder in a VBA userform, but i cant run the code correctly, it always returns me with a "Run-time error '13': Type mismatch" error on the Me.Controls(Objeto).Value = vbNullString line.
someone can give me some light?
Sub TB_Enter(Objeto)
If Len(Me.Controls(Objeto).Tag) = 0 Then
Me.Controls(Objeto).Tag = Me.Controls(Objeto).Value
Me.Controls(Objeto).Value = vbNullString
End If
End Sub
Sub TB_Exit(Objeto)
If Len(Me.Controls(Objeto).Value) = 0 Then
Me.Controls(Objeto).Value = Me.Controls(Objeto).Tag
Me.Controls(Objeto).Tag = vbNullString
End Sub
Private Sub TextBox1_Enter()
TB_Enter ActiveControl.Name
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TB_Exit ActiveControl.Name
End Sub