Type Mismatch problem

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,601
On my form I have a textbox1 control and this code In Form Activate

Code:
action2 Me.TextBox1, "fred"

Sub action2(tb As TextBox, tt As String)
    tb.Text = tt
End Sub
I've tried various things, Inside quotes, with & without "Me" but keep getting Type Mismatch errors.
I can't see why this shouldn't work. Any reason ? Thanks.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
22,884
Try
Code:
Sub action2(tb As MSForms.TextBox, tt As String)
I think TextBox is a shape, MSForms.TextBox is on a userform.
 

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,601
Thank you Mike, that fixed it. Found I had to do the same for labels and images too.
 

Forum statistics

Threads
1,085,542
Messages
5,384,327
Members
401,887
Latest member
Somesh

Some videos you may like

This Week's Hot Topics

Top