Launch 2nd Userform from 1st Userform

largeselection

Active Member
Joined
Aug 4, 2008
Messages
358
Hi,

So I have some code and Userform1 tracks the progress of that code. As part of the code it closes the workbook, waits 15 seconds, then re-opens the workbook and finishes the code. I have tried many combinations to try and have a second userform open as part of the code, but I keep getting "activeX can't create object" errors. Currently the set up is like this:

Main Code:
Code:
Userform1.Show False

Userform1 Code:
Code:
PrivateSub Userform1_Activate()
Code
Code
Code
 
Unload Me
Exit Sub
 
PrivateSub Userform1_QueryClose()
Application.OnTime Now + TimeValue("00:00:20"), "ResumeCode"
ThisWorkbook.Close
End Sub

Resume Code:
Code:
ThisWorkbook.Activate
UserForm2.Show False

Userform2 Code:
Code:
PrivateSub Userform2_Activate()
Code
Code

Everything works correctly until UserForm2.Show. So the userform appears and adjust as necessary, the workbook closes, and it reopens correctly, but then I get the activeX can't create object error at the Userform2.Show. Any ideas on how I need to adjust it to get it working?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

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