Solved

Can you index objects in VBA?

Posted on 1998-08-12
3
154 Views
Last Modified: 2010-04-30
I'm converting a standalone application into an Excel VBA application.  In the standalone, I have a series of pictures which are made visible and invisible (so as to animate).  They are Picture6(0) to Picture6(79).  However in Excel, I cannot do this because there is no index property for objects; they must be given entirely unique names.

So my question is, is indexing not allowed at all, or is it done differently that I am not aware of (as with some other small differences that I've noticed).  If it isn't allowed could you please give me some suggestions as to how I would go about doing this?

Thank you.
0
Comment
Question by:leekk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:dapperry
ID: 1468690
I don't think you can have a control array in VBA.  Perhaps you could call the pictures something
like PICTURE1, PICTURE2, PICTURE3, PICTURE4 - and then use something like the
eval function to refer to them.  I'm not sure of a good way to have common events amoung the objects , like a control array has, so thats why this is just a comment.

:) D Perry
0
 

Accepted Solution

by:
lstefano earned 100 total points
ID: 1468691
What about:
sub ix()
   set md = worksheets(1)
   for i=1 to md.shapes.count
      md.shapes(i).visible=false
   next i
end sub

Notice that the collection Shapes can be indexed by index and/or by name...
0
 

Author Comment

by:leekk
ID: 1468692
Thanx.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question