MultiPage UserForm, set page in view on Show

LuKate

Board Regular
Joined
Mar 13, 2013
Messages
77
I have a 2 page MultiPage UserForm. When loaded page 1 shows by defult because that is the one that is on view within the VBA editor.

I know I can change it there so that page 2 would show when the user form loads. But I need page 1 to be the default show and have page 2 show just when the user form is called from one particular procedure. I hope that makes sense!

I have tried the following in both the procedure that calls the user form and also in the userform_initialize procedure:

Code:
frmEdCol.MPChart.Pages(pgChart).SetFocus
and:
Code:
frmEdCol.MPChart.Pages(2).SetFocus

frmEdCol, MPChart and pgChart are the names of the UserForm, MultiPage and page 2 respectively.

I also tried the same but without the Pages (i.e. MPChart(pgChart)

I am sure there must be a way to get this to work but it eludes me!

Any help or suggestions greatly apreciated.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi,

From your explanation, it would appear that you only need to add a condition based on the instruction : Application.Caller

HTH
 
Upvote 0
Do these subs do what you want?

Code:
Sub showPage0()
    frmEdCol.MPChart.Pages(1).Enabled = False
    frmEdCol.MPChart.Pages(0).Enabled = True
    frmEdCol.MPChart.Value = 0
End Sub
Sub showPage1()
    frmEdCol.MPChart.Pages(0).Enabled = False
    frmEdCol.MPChart.Pages(1).Enabled = True
    frmEdCol.MPChart.Value = 1
End Sub
 
Upvote 0
Put this in the procedure that should show page 2, before the code that actually shows the form,
Code:
frmEdCol.MPChart.Value = 1
and in design view set the Value property of the multipage to 0.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,241
Members
449,075
Latest member
staticfluids

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