Syntax for Show/Hide using a form variable

insomniac53

Board Regular
Joined
Sep 3, 2013
Messages
104
I'm writing a subroutine called CreateFormTextBox which does exactly that - creates a text box on a specified form, puts it in the right place, formats it and fills it with a value - all done through passing a few parameters. And it works! However, the very simple Show and Hide don't work when used in conjunction with the same form variable. Here's the test sub:
Code:
Sub test()
    Dim f As MSForms.UserForm
    Set f = MyTestForm
    CreateFormTextBox(f, [form name and various other parameters])
    f.Show
    MsgBox "Done"
    f.Hide
End Sub
The 'f' variable passes as a parameter without a problem, yet the Hide and Show will only work if I use the full form name. Any suggestions why this is happening? Thanks.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,214,867
Messages
6,122,002
Members
449,059
Latest member
mtsheetz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top