Error when trying to Show Userform when Workbook Opens

JeremyLearned

New Member
Joined
May 25, 2011
Messages
1
Here’s my dilemma: I have a userform called frmLiabilityPlus that I want to show as soon as the workbook opens. In the workbook_open event I have the following code:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
frmLiabilityPlus.Show
<o:p> </o:p>
Now, if I run the code from the VBA editor window, it works fine.
<o:p> </o:p>
But, if I save the workbook and re-open, hopefully showing the userform, it blows up giving me errors on that line of code with messages saying, essentially, it can’t locate the form.
<o:p> </o:p>
<o:p>I even deleted all the code in userform_initialize to see if something there was something in it causing problems, but no luck.</o:p>
<o:p></o:p>
In some further testing, I added a button and a macro to the visible sheet. Activating the button runs the exact same code, and it runs fine that way.
<o:p> </o:p>
Any thoughts or ideas would be greatly appreciated!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi and welcome to the board.

...giving me errors on that line of code with messages saying, essentially, it can’t locate the form.

You need to Load the form into memory before you can show it.

Code:
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] Workbook_Open()
    Load frmLiabilityPlus
    frmLiabilityPlus.Show
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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