View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default VBA to save a chart as a GIF

See if this helps
For Each c In ActiveSheet.Shapes
'MsgBox c.Name
if c.Name = "Picture 1" Then MsgBox "OK"
Next

Sub ExportChartGIF()
ActiveChart.Export Filename:="C:\a\MyChart.gif", _
FilterName:="GIF"
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Barb Reinhardt" wrote in message
...
I have the following snippet of code to save a chart as a GIF. What am I
missing?

For Each WS In aWB.Worksheets
For Each ChtObj In WS.ChartObjects

If ChtObj.Name = "myName.gif" Then
fname = aWB.Path & "\myFileName.gif"
WS.Select
ChtObj.Select
ChtObj.Export Filename:=fname, FilterName:="GIF"
End If
Next ChtObj
Next WS


Thanks,
Barb Reinhardt