PDA

View Full Version : Determining name of nested multipage...



Treygor
02-12-2007, 09:44 PM
I am having a little difficulty with my program and I need some help. I will first give the basics about what I am doing and then I will state what I need help with. Please keep in mind I am somewhat new to VBA programming and I apologize in advance if this is confusing.



***WHAT I HAVE DONE***
I have a multipage nested inside of another multipage and I need to know how to determine the name of the active nested multipage. For example, say I have 6 (1,2,3,4,5,6 are the names) pages on multipage-level1. On page "1" of the multipage-level1, I have 3 (a1,b1,c1 are the names) pages and these would be on a dynamically created multipage. I have the same thing on the remaining multipage-level1 pages with the nested multipage names being ax,bx,cx where x is the active multipage-level1 name.

If I click on multipage-level1 page1, the default active nested multipage is a1.

If I click on multipage-level1 page2, the default active nested multipage is a2.

The same thing exists with the remaining multipage-level1 pages.




***WHAT I NEED HELP WITH***
I need to know how to find the name of the active nested multipage even if I don't click on the nested multipage. For example, if I were to click on multipage-level1 page 2, I would like a msgbox to display the active nested multipage name.

I am using a class module for the dynamically created nested multipages and I can use a change (a change event in the class module) event to fire the active nested multipage name but this only works if I change the active nested multipage.

Any suggestions would surely be appreciated.


-:help Treygor

Treygor
02-14-2007, 07:08 PM
ANYONE HAVE ANY SUGESTIONS?

Steiner
02-15-2007, 07:14 AM
Ok, this one is somewhat crude, but it seems to work (at least when you have exactly 1 multipage per page:

Private Sub CommandButton1_Click()
Dim ctrl As Control

For Each ctrl In MultiPage1.SelectedItem.Controls
If TypeOf ctrl Is MultiPage Then
MsgBox ctrl.SelectedItem.Caption
End If
Next ctrl

End Sub

Daniel

mdmackillop
02-15-2007, 10:30 AM
Hi Treygor,
Can you post a workbook containing your form?

MCForty4
03-01-2012, 09:34 AM
This works in VBA V 7.0

frmProperty.pgMain.Pages(6).mpEscrow.Pages(2).Caption

'frmProperty = the name of the form
'pgMain = the main Multipage
'mpEscrow = the Multipage that is nested under the 7th page of pgMain