views:

188

answers:

1

I have seen many references to doing something like the following to insert a picture in Excel:

Set p = ActiveSheet.Pictures.Insert(PathToPicture)

Where can I find the canonical documentation for this?

+1  A: 

I can't find this in the doco in VBA for Excel 2007... i have seen a few things go missing in the VBA doco between 2003 and 2007.

So my first suggestion is look in a copy of Excel or Access 2003 help files.

In the past i've used the Shapes collection for images and shapes, which is handy for iterating over them later on. Eg;

sh.Shapes.AddPicture "c:\temp\pic.jpg", True, True, 0, 0, 80, 60

However you will need to know the size of the image, which may or may not be a problem.

Mark Nold
Yeah, I can't find any official documentation either, despite hunting everywhere. Can we safely assume this is an undocumented feature (and thus should be used with caution)?
Charles Roper
Yep i'd agree. It doesn't seem to be a member of WorkSheet (i just checked the Excel 2003 VBA doco). Maybe it appears if you do a macro record which is why it's everywhere.
Mark Nold