Reference to pages in a Multipage Control

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
 
M

Mark

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.
 
S

scain2004

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
 
D

Dave Peterson

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!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top