View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sean[_11_] Sean[_11_] is offline
external usenet poster
 
Posts: 17
Default Moving/deleting pictures within charts via macros

What if, instead of selecting/deleting you used variables to refer to
the various parts. I think that pictures are stored on the Chart and NOT
the ChartObject and below are some examples you what you might need.

----
Sean
"Just press the off switch, and go to sleep!"


'----------------------------------------------
'----------------------------------------------
Dim ch As Excel.Chart, shp As Excel.Shape, shpr As Excel.ShapeRange

' this is the chart we will be working with
Set ch = ActiveSheet.ChartObjects("Chart 55").Chart

' add a new picture from a file
Set shp = ch.Pictures.Insert(file_name).ShapeRange(1)

' delete the picture we have just added
shp.Delete

' delete a specific picture from our chart
ch.Shapes("Picture 2").Delete

' delete ALL the pictures from our chart
ch.Shapes.SelectAll
Set shpr = Selection.ShapeRange
shpr.Delete

'----------------------------------------------
'----------------------------------------------


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!