Locate the chart insertion.

NdNoviceHlp

Well-known Member
Joined
Nov 9, 2002
Messages
3,600
Can't seem to get the right syntax for placing an inserted picture in a chart (I assume it's possible?). The following inserts the .gif file in the upper left corner of the chart. I would like to move the picture to the lower left corner of the chart. If anyone has abit more code I'd appreciate it. Thanks. Dave
Code:
'add ICON to chart
ActiveChart.ChartArea.Select
ActiveChart.Pictures.Insert ("C:\Picname.gif")
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
What does the macro recorder give you when you use the UI to get what you want?
 
Upvote 0
Thanks Tushar. The code I posted was derived from the macro recorder. As far as I can tell, you can't specify the insertion point. Hence, the posted question. Haven't been able to google anything yet either. Would sure appreciate further assistance. Dave
 
Upvote 0
I get it...move the picture after the insertion. Thanks Tushar. Have a nice day. Dave
Code:
'add ICON to chart
ActiveChart.ChartArea.Select
ActiveChart.Pictures.Insert("C:\Picname.gif").Select
Selection.ShapeRange.IncrementTop 210
 
Upvote 0
Did you move the picture where you wanted it? In 2003, after some tweaking, the following works. The tweaking involved the "usual" method for putting something flush bottom-right in its container, i.e., the child's left = parent's width - child's width and the same for the top.
Code:
Sub Macro1()
    With ActiveSheet.ChartObjects(1).Chart
    .Pictures.Insert ("C:\Temp\Pic.jpg")
    MsgBox .Shapes.Count
    With .Shapes(1)
    .Left = ActiveChart.ChartArea.Width - .Width
    .Top = ActiveChart.ChartArea.Height - .Height
        End With
        End With
    End Sub

Thanks Tushar. The code I posted was derived from the macro recorder. As far as I can tell, you can't specify the insertion point. Hence, the posted question. Haven't been able to google anything yet either. Would sure appreciate further assistance. Dave
 
Upvote 0
Many thanks for the extra learning Tushar. That's exactly the stuff I was looking for to fancy up some charts. Dave
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,184
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top