Results 1 to 2 of 2

Thread: Dynamically referencing collections created during run time

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    8

    Question

    I am using Microsoft Excel 97 VBA to create an application containing 5 frames, each frame containing 49 labels. Each frame has it's own collection. I would like to be able to
    sequence through each Userform!Frame(i).Controls() in order to consolidate my code..

    Currently my code is similiar to

    For Each Control In Userform!Frame1.Controls()
    'Get Frame1 data

    Next Control

    For Each Control In Userform!Frame2.Controls()
    'Get Frame2 data

    Next Control

    For Each Control In Userform!Frame3.Controls()
    'Get Frame3 data

    Next Control
    ...

    The Get Frame1, Get Frame2, ... portions of the code are identical.

    What I would like to do is:

    for i = 1 to 5
    For Each Control In Userform!Frame(i).Controls()
    'Get Frame data

    Next Control
    next i

    However, the above code does not work.

    Help!

    Vin
    Vin Lis

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Well if the frames would been a control array it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width