MultiPage UserForm, set page in view on Show

LuKate

Board Regular
Joined
Mar 13, 2013
Messages
76
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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
Hi,

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

HTH
 

tlowry

Well-known Member
Joined
Nov 3, 2011
Messages
1,367
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
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.
 

Forum statistics

Threads
1,136,787
Messages
5,677,731
Members
419,716
Latest member
MPunt

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
Top