PDA

View Full Version : Solved: How do I identify the type of graphic object that is currently selected?



xltrader100
08-15-2008, 08:10 PM
I have a sheet with a large number of various types of graphic objects, and I'd like to know how to determine (with code) what they are. Using typename returns either Picture or OLEObject, but I need to know specifically if it's a bitmap or a metafile. For my immediate requirement, I'm just looking at one object at a time which is selected on the sheet, but more generally is there one big loop that drills down into each object on the sheet and reads back everything knowable about each one? I saw something like that for controls but can't find anything similar for graphics objects.

TomSchreiner
08-15-2008, 10:55 PM
Please explain "why" you need to know the picture type. Maybe there is another approach. I, for one, would rather have a toothache than to try and drill down into shapes. (not really) That might explain why I have not seen a one size fits all iteration of this group of classes. :)

xltrader100
08-16-2008, 07:16 AM
Hi Tom, I'm building a form to store custom faces in libraries. If the user clicks on a face and says "store this one", then it will go to one of two different places depending on whether it's a standard lo rez bitmap or if it's a hi rez metafile. So I just need some way to distinguish between the two. I can send samples of each type if that would help.

TomSchreiner
08-16-2008, 07:44 AM
How are the shapes inserted to begin with? Are these from the web? The reason I would like to know more about your project is to see if we are limited to your presupposed solution. For one thing, I may be wrong but I do not think I am, any picture in Excel, besides inserted object packages, is converted to an emf. To prove this, insert a bmp and then rescale it. It scales so well because Excel converted it to an emf.

xltrader100
08-16-2008, 08:32 AM
Thanks Tom, that was the clue I needed to get me on the right path. Like so many things in VBA, there are hard ways and there are easy ways, and I was taking the hard way. It turns out that I don't have to determine the format of the Picture that's clicked on because I can tap into the process where they're brought onto the sheet and make them whatever I want them to be. So, problem solved. Thanks for responding.