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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,223,157
Messages
6,170,419
Members
452,325
Latest member
BlahQz

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