Reference to pages in a Multipage Control

  • Thread starter Thread starter scain2004
  • Start date Start date
S

scain2004

Is there any specific way to refer to a page(tab) in a Multipage contro
in code?

I have:

frmSchedDates is the form
MultiPage1 is the multipage control
pgSched, pgResched, pgRemove are the pages(tabs).

As I'm sure you well know, when you start typing in an object name i
VBA close ones will pop up. Multipage1 pops up but, the individua
pages don't.

frmSchedDates.MultiPage1.pgSched doesn't seem to work :(

Thanks for your insight. :)

Stev
 
Hi, Try this
UserForm1.MultiPage1.Pages.Item = page2
I just put this into the load sub and Page 2 was selected

So I assume the Item is the name you have chosen for each
page.
 
Yeah, I believe so.

The names of the pages are pgSched, pgResched, and pgRemove.

Basically, what I'm trying to do is when the userform initializes
want to check for certain conditions. If they're true, I want to b
able to enable or disable the pages.

Will this work
 
I used this and it worked ok:

Option Explicit
Private Sub UserForm_Initialize()

If Worksheets("sheet1").Range("a1").Value = 3 Then
Me.MultiPage1.Pages("page3").Enabled = False
Else
Me.MultiPage1.Pages("page3").Visible = False
End If

End Sub

Page3 was the (name) property--not the caption.

(.enabled or .visible is the next question!)
 
Back
Top