"Object Required" error when showing a User Form which consists of Multipage

HosseinReihai

New Member
Joined
Dec 30, 2015
Messages
5
Hello all,

I have a very disgusting and confusing problem with my VBA codes:

I have a user form which consists of a four-page multipage control.

I have Also a Module for public subs and funcs.

I have placed an Auto_Open sub in the Module which is:
Code:
Sub Auto_Open()


'First it deletes the last projects remainings including tasks and etc
ViewApplyEx Name:="Resource Sheet", ApplyTo:=0
SelectAll
Application.DisplayAlerts = False
EditDelete


ViewApplyEx Name:="gantt chart", ApplyTo:=0
SelectAll
EditDelete
Application.DisplayAlerts = True






'set the calendar for all days working
Dim i As Integer
For i = 1 To 7
    ActiveProject.Calendar.WeekDays(1).Working = True
Next i


'Now, everything's ready to introduce new project
MainMenue.Show


End Sub
The line "MainMenue.Show" has to initiate the user form but when I Open the file, The "Object Required" error appears. As its obvious, "MainMenue" is that user form.

I have to say that of the multipage's pages is the materials which I have copied from another user form I wrote before, which works well with "UserForm.Show" without any errors.

This is MSP VBA but I think its prob is similar with Excel.

PLEASE HELP ASAP. THIS IS VERY IMPORTANT FOR ME!
 
Last edited by a moderator:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Use f8 to step through the code until you get to the real error in the form code.
 
Upvote 0
Use f8 to step through the code until you get to the real error in the form code.

Thanks RoryA

When error shows up, this line turns yellow:

MainMenue.Show

I have this command with another user form and it works well but that user form has no Multipage.
Is this the real error you mean?

Thanks Again
 
Upvote 0
No - when the debugger takes you to that line, press Debug, then press f8 until you get to the real error.
 
Upvote 0
No - when the debugger takes you to that line, press Debug, then press f8 until you get to the real error.

Thanks again Rory,

It works!

All the problem was a typo in the userform_initialize sub, I have changed the multipages name but have not changed the codes which call it.

Many many thanks
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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