Multipage Control Pages - Changing Index Value in Code
Your code worked fine for me. strTabNames had a lowerbound of 1.
--
Regards,
Tom Ogilvy
"misseill" wrote in message
oups.com...
I have a multipage control, mpManyTabs, and an array, strTabNames. I
want the pages in mpManyTabs to be indexed in the order determined by
the array's entries. All of the pages have captions that correspond to
an entry in the array. I am able to cycle through the pages, look at
the caption and see if it matches my array entry. If it does, I'd like
to change the matching page's index to be the array's index. Can I do
that in code? The line
mpManyTabs.Pages(lngPages).index = lngCount-1
below is giving me trouble.
Private Sub ShuffleTabs(strTabNames() As String)
Dim lngCount As Long
Dim strTabName As String
Dim lngPages As Long
For lngCount = 1 To UBound(strTabNames)
'cycle through mpManyTabs.Pages, until you find the caption
'that is the same as strTabNames(lngcount)
For lngPages = 0 To mpManyTabs.Pages.Count - 1
If mpManyTabs.Pages(lngPages).Caption = strTabNames(lngCount)
Then
'Index starts at zero. subtract one!
mpManyTabs.Pages(lngPages).index = lngCount-1
Exit For
End If
Next lngPages
Next lngCount
End Sub
I appreciate your help in advance, and I hope I was clear enough!
|