Reputation: 721
I have a Userform and this is the code for my control button. Trying to pass a Textbox to a function using the following code
Private Sub pdclear_Click()
Dim textinput As TextBox
Set textinput = frmBigInputBox
Call clear(textinput)
End Sub
The line highlighted yellow in debug mode is
Set textinput = frmBigInputBox
Why does this cause a "13 type mismatch" error??? What am I doing wrongly?
Upvotes: 3
Views: 1979
Reputation: 976
I could reproduce the error and found this: http://forums.devx.com/showthread.php?168758-Excel-VBA-Using-TypeOf
So you will have to define it as MSForms.TextBox
, it seems.
Upvotes: 3
Reputation: 5416
Try using MSForms.TextBox. As in
Dim textinput As MSForms.TextBox
Works for me.
Upvotes: 5