ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Confusion on Multipage Tabbing (https://www.excelbanter.com/excel-programming/404219-confusion-multipage-tabbing.html)

WLMPilot

Confusion on Multipage Tabbing
 
I have two books on Excel VBA and have googled "Multipage Tab" and I am still
in the dark about how to set things up when using this feature. I have
already set up a userform using page1.

The only reference I have made to page1 in my code is below:

Private Sub UserForm_Initialize()
MultiPage1.Value = 0

There is no other reference made anywhere. As best as I can tell, all pages
would be initialized in this section. My code works fine, but I am at a lost
when I start to design other pages. I noticed when I view code from page2,
that all the code from page1 is brought up. Thus my confusion as to how it
is kept separate. Maybe only because the textboxes, combo/Listboxes, etc
will increment. I assume I will not have a textbox1 on both pages.

My question is where and when are references needed regarding multipage
tabbing and how is code like "MultiPage1.Value = 0" used?

Thanks,
Les

Peter T

Confusion on Multipage Tabbing
 
and how is code like "MultiPage1.Value = 0" used?

That code would activate the first page of a multipage control named
MultiPage1

The Index of the first page is zero, so to activate the last page you would
do this

MultiPage1.Value = MultiPage1.Count - 1

Afraid I don't really follow the rest of your question, revert back if the
above is not enough.

Regards,
Peter T


"WLMPilot" wrote in message
...
I have two books on Excel VBA and have googled "Multipage Tab" and I am

still
in the dark about how to set things up when using this feature. I have
already set up a userform using page1.

The only reference I have made to page1 in my code is below:

Private Sub UserForm_Initialize()
MultiPage1.Value = 0

There is no other reference made anywhere. As best as I can tell, all

pages
would be initialized in this section. My code works fine, but I am at a

lost
when I start to design other pages. I noticed when I view code from

page2,
that all the code from page1 is brought up. Thus my confusion as to how

it
is kept separate. Maybe only because the textboxes, combo/Listboxes, etc
will increment. I assume I will not have a textbox1 on both pages.

My question is where and when are references needed regarding multipage
tabbing and how is code like "MultiPage1.Value = 0" used?

Thanks,
Les




JLGWhiz

Confusion on Multipage Tabbing
 
Here is a little more info on the MultiPage.

When the multpage is added to a UserForm the Properties
Window shows the name MultiPage1, if it is the first one
added. Then, when you click the tab, Page1, the properties
window changes to show Page1, tab Page2 the properties
window shows page2. This means that each page has its own
properties, but the code module is for the MultiPage only.
The individual pages do not have their own code modules.
You must use a page index reference to control a specific
page: MultiPage1.Pages(0) would be page1.

To add a caption to page2 with code in the UserForm module:

Private Sub UserForm_Initialize()
MultiPage1.Pages(1).Caption = "Flight Plan"
End Sub

The MultiPage provides for event code and each control
which can be applied to individual pages by index number.
For example:

Private Sub MultiPage1_Click(1)
'Do something
End Sub

Would be a click event for page2 of the MultiPage.

Remember that the index number is always one less than
the page number.

"WLMPilot" wrote:

I have two books on Excel VBA and have googled "Multipage Tab" and I am still
in the dark about how to set things up when using this feature. I have
already set up a userform using page1.

The only reference I have made to page1 in my code is below:

Private Sub UserForm_Initialize()
MultiPage1.Value = 0

There is no other reference made anywhere. As best as I can tell, all pages
would be initialized in this section. My code works fine, but I am at a lost
when I start to design other pages. I noticed when I view code from page2,
that all the code from page1 is brought up. Thus my confusion as to how it
is kept separate. Maybe only because the textboxes, combo/Listboxes, etc
will increment. I assume I will not have a textbox1 on both pages.

My question is where and when are references needed regarding multipage
tabbing and how is code like "MultiPage1.Value = 0" used?

Thanks,
Les



All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com