Solved

Can you index objects in VBA?

Posted on 1998-08-12
3
152 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

740 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