#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Frame Index

You can do something like this:

Private Sub CommandButton1_Click()
Dim frm(0 To 2) As MSForms.Frame
Dim tmp As MSForms.Frame
Dim pg As MSForms.Page
For Each pg In UserForm1.MultiPage1.Pages
i = 0
For Each ctrl In pg.Controls
If TypeOf ctrl Is MSForms.Frame Then
Set frm(i) = ctrl
i = i + 1
End If
Next
If i 1 Then
If frm(0).Left frm(1).Left Then
Set tmp = frm(1)
Set frm(1) = frm(0)
Set frm(0) = tmp
End If
End If
For i = 0 To 1
If Not frm(i) Is Nothing Then
Debug.Print pg.Caption & " " & frm(i).Name
End If
Next
Next

End Sub

--
Regards,
Tom Ogilvy

"aspadda" wrote in message
...
Here is a situation : I have a form with multipage control (Multipage has

6 pages). On each page i have 2 frames. I want to access the frames (through
code) in a sequence (for eg : page1.frame1 and then page1.frame2 and then
page2.frame2.page1 and so on.........). I am using the below code and what
happens is that it picks the sequence as frames were created..(for eg you
created a frame on page 2 and then you went back and created another frame
on frame 1...it takes the the frame created on page 2 first and then the
frame created on page 1) but i want the other way around. I went and looked
into properties to set the index but that does'nt work.

Help will be appreciated...

Code


Private Sub CommandButton1_Click()
Dim ctrl As Control
Dim msg As String
For Each ctrl In UserForm1.Controls
If LCase(Mid(ctrl.Name, 1, 3)) = "fra" Then
msg = msg & vbNewLine & ctrl.Name
End If
Next ctrl
MsgBox msg
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time Frame Richard Excel Discussion (Misc queries) 1 May 13th 08 02:37 PM
frame Nick London Excel Discussion (Misc queries) 0 July 4th 06 01:17 PM
Frame Around Pie Chart Diane Walker Charts and Charting in Excel 2 March 7th 06 09:01 PM
How to attach legend frame to chart frame? holg3r Charts and Charting in Excel 2 July 7th 05 11:41 PM
3 Time frame 11050204 Excel Worksheet Functions 1 June 27th 05 03:05 AM


All times are GMT +1. The time now is 08:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"