UserForm3.Show VBA Run-time error 424

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
I am getting a Run-time error '424':
Object required

when I try to run this code
I have a UserForm3 not sure whats happening

Code:
Sub Execute()
'MsgBox "Please review the data on each of the ProPricer templates before exporting the data to ProPricer"

UserForm3.Show

            UserForm3.LabelProg.Width = 20
            UserForm3.LabelProg.Caption = "5%"
            DoEvents

EXMaterialsInput
Sheets("Step 6").Range("C12").Value = "Materials Input template updated: " & Now

            UserForm3.LabelProg.Width = 40
            UserForm3.LabelProg.Caption = "20%"
            DoEvents
            
EXMaterialDistribution
Sheets("Step 6").Range("C13").Value = "Material Distribution template updated: " & Now

            UserForm3.LabelProg.Width = 80
            UserForm3.LabelProg.Caption = "41%"
            DoEvents
            
EXAssemblies
Sheets("Step 6").Range("C14").Value = "Assemblies template updated: " & Now

            UserForm3.LabelProg.Width = 120
            UserForm3.LabelProg.Caption = "63%"
            DoEvents
            
EXAssemblyElements
Sheets("Step 6").Range("C15").Value = "Assembly Elements template updated: " & Now

            UserForm3.LabelProg.Width = 160
            UserForm3.LabelProg.Caption = "82%"
            DoEvents
            
EXProducts
Sheets("Step 6").Range("C16").Value = "Products template updated: " & Now

            UserForm3.LabelProg.Width = 195
            UserForm3.LabelProg.Caption = "98%"
            DoEvents
            
            
UserForm3.Hide

End Sub

the debug highlights
UserForm3.Show
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
There is something conceptually wrong with your code: when you execute UserForm3.Show the control pass to the userform and the rest of the macro will not execute until you close the form.
You could open the form using vbModeless, but this changes the way the form and the rest of your work area interact.
VBA Code:
UserForm1.Show vbModeless
Using vbModeless the macro will continue after the userform opens, but I ignore what the commands EXMaterialsInput, EXMaterialDistribution and similar do, so I cannot foresee the overall result.

Bye
 
Upvote 0
Most likely the error is in the Userform_Initialize or Userform_Activate events in the form. In the VB Editor, change your error handling options (Tools - Options - General tab) to 'Break in class module' then try the code again and it should highlight the actual offending line of code.
 
Upvote 0

Forum statistics

Threads
1,224,833
Messages
6,181,242
Members
453,026
Latest member
cknader

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