Wrox Programmer Forums
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 23rd, 2004, 11:57 AM
Authorized User
Join Date: Aug 2003
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Default Frame Index

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...


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

Ajitpal S Padda
Ajitpal S Padda
Old February 25th, 2004, 12:39 PM
Authorized User
Join Date: Feb 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts

I work around this problem by giving the frames specific names, essentially concatenating the word "frame" and the index I want it to have. If I insert another frame, I do have to review/revise all the frame names to make sure they are "numbered" in the order I want them.

Old February 25th, 2004, 12:50 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts

I suppose you could always put your frame names into an array or collection as part of the form's init routine. That way you could more easily alter the 'running order' and add/delete at will.

There are two secrets to success in this world:
1. Never tell everything you know

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set one frame src from other frame akumarp2p ASP.NET 1.x and 2.0 Application Design 2 March 13th, 2007 04:13 AM
offsite link to iframes index page and child frame raiderray Javascript How-To 1 January 3rd, 2006 05:01 PM
parsing form data from frame to other frame audio-catalyst Classic ASP Basics 5 January 3rd, 2006 02:57 PM
Call right frame Page_Load event from left frame. ochanarachel Classic ASP Basics 0 January 28th, 2005 05:13 AM
Refresh a frame from another frame czambran Javascript 3 October 21st, 2004 11:20 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.