I have a userform and I want to call it in an if statement... i want to do something like if IsEmpty(Textbox) then
[code]
How do I call the textbox?
I have a userform and I want to call it in an if statement... i want to do something like if IsEmpty(Textbox) then
[code]
How do I call the textbox?
if your form is called 'userForm1' then the code is
![]()
Please Login or Register to view this content.
i dont mean to show the textbox, i just mean to call the textbox like a variable.
Hi,
HTH![]()
Please Login or Register to view this content.
Richard Buttrey
RIP - d. 06/10/2022
If any of the responses have helped then please consider rating them by clicking the small star iconbelow the post.
Hi papermoon
Perhaps you're looking for something like this
John![]()
Please Login or Register to view this content.
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
FYI, in order to be able to refer to the textbox's value, the userform must be loaded. If you simply refer to say Userform1.Textbox1.Value in your code, then the form will be implicitly loaded and you will get the default value of the text box - usually "". This is one good reason not to use the default instancing.
Everyone who confuses correlation and causation ends up dead.
Hi romperstomper
Thisonce or twice and I didn't know why. Thanks for the feedback.If you simply refer to say Userform1.Textbox1.Value in your code, then the form will be implicitly loaded
John
That's why it's better to use something like:
and make sure that your form gets hidden not unloaded. Then if it has been unloaded somehow, you'll get an error when you try and access its controls/properties rather than a new instance created (which can make debugging really hard!)![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks