?
Solved

Can you index objects in VBA?

Posted on 1998-08-12
3
Medium Priority
?
155 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 400 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 7 hours left to enroll

777 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