Multipage Control Pages - Changing Index Value in Code

  • Thread starter Thread starter misseill
  • Start date Start date
M

misseill

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!
 

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

Back
Top