Inserting a picture

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I'm writing a macro to insert a picture either on the spreadsheet or in
the window of an embedded chart. When I record the macro for inserting a
picture, the command line ends with a .select. I get an error if I remove
the .select from the command line. Based on some other stuff I'm doing, the
"select" part of the command line is taking the focus away from the other
activity. Can you give me some advice for how to insert a picture (without
pre-specifying the image dimensions ala Shapes.AddPicture command) accepting
the "default" incoming image dimensions?

Thanks much.
 
Hi Tom,
The command line that works to insert a picture is as follows:

ActiveChart.Pictures.Insert (FilePath).select

I can then position the picture, in code, wherever I want depending on the
current x,y position of the plot point selected.

Problem is the ".select" portion takes the focus away from the user
successively selecting other individual plot points. i.e. they end up having
to re-click the series, then re-click on an individual point in the series.
My code is trapping the event where a single plot point is selected and I
delete the previous picture and insert a new one depending on which point is
selected. I want to have the operation as smooth as possible. I know how to
delete the previous picture when a new point is selected. The
"Pictures.Insert" command doesn't require me to specify width, height, and
position coordinates at the time of the function call like the following
command:

ActiveChart.Shapes.AddPicture ThePath, False, True, LeftPos, TopPos, Width,
Height

My picture widths and heights vary so I don't know the aspect ratio ahead of
time. The overall sizes are sufficiently small so I can live with the
default insertion size as is.
 
If
ActiveChart.Pictures.Insert (FilePath).select

works for the insertion,

then

ActiveChart.Pictures.Insert FilePath

without the select and ( ) should work

--
Regards,
Tom Ogilvy
 
Hi Tom,
I thought I tried that but obviously I didn't. It worked. Thanks for
taking time to respond. You and your mates are a terrific resource.
 
Back
Top