Error 424 - Object Required

azizrasul

Well-known Member
Joined
Jul 7, 2003
Messages
1,304
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
In my VBA code I open another workbook (call it Book2.xlsm) which has several user forms. The code allows the first form to open but get an error (Error 424 - Object Required) when the second user form is being opened. Both user forms open OK in Book2.xlsm.

Code:
    Windows(strSchemeFilename).Activate
    Load frmCompanyDetails
    frmCompanyDetails.txtName = strCompanyName
    Load frmQuoteDetails 'Errors here
    frmQuoteDetails.txtDirectory = strPDFDir
    frmQuoteDetails.txtDocName = "ABC"
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I eliminated that by commenting all the Initialize code, but no luck.
The form opens OK in it's host workbook.
Tried swapping forms around so that the code calls the rogue form first, still no luck.
Tried opening a third user form, same error. Seems to only like user form "frmCompanyDetails".
 
Last edited:
Upvote 0
All the forms use the Activate event instead of the Initialize event.
 
Upvote 0
In the VBE select Tools > Options > General > select Break in Class Module > OK.
Then try running the code again & it should hopefully show where the problem is.
 
Upvote 0
Which workbook is the code in and which workbook is the userform that's causing the problem in?
 
Upvote 0
Just had a brainstorming session with a colleague and we realised that the reason why frmCompanyDetails was 'working' was that the calling wb had a form of the same name. So in essence it wasn't even loading frmCompanyDetails of the other wb.
I guess I need to have a macro in the other wb and somehow pass the values from the calling wb to the forms.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,222,749
Messages
6,167,967
Members
452,158
Latest member
MattyM

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