Exporting Charts as GIFs

A

Adam Sparks

Hey all I asked this a couple years ago and got this script
essentially:

Sub exportChartAsImage()
Dim myWidth As Double
Dim myHeight As Double
ActiveChart.PlotArea.Select
Selection.ClearFormats
'Resizes the Chart For the Web Image
myWidth = 1024 ' or your desired GIF width in pixels
myHeight = 768 ' or your desired GIF height in pixels
ActiveChart.Parent.Width = myWidth * 0.75
ActiveChart.Parent.Height = myHeight * 0.75
'Exports the GIF File
ActiveChart.Export "C:\Documents and
Settings\Adam\Desktop\Chart.gif", "GIF"
End Sub


which is great BUT I need to also be able to export charts
that are on their own sheet and are not objects in a
spreadsheet.

Is this possible to do? TIA!
 
T

Tom Ogilvy

Chart1.Select
ActiveChart.Export "C:\Documents and
Settings\Adam\Desktop\Chart.gif", "GIF"
 
G

Guest

I thought it was something along those lines but wasn't
having much luck with it.

Thanks much Tom!

regards,
Adam Sparks
 
T

Tom Ogilvy

You would need a chart sheet that has a codename of Chart1

you can use anything that gets the a reference to a chart object (not
chartobject)

Charts(1).Select
Charts("Chart1").Select

activesheet.ChartObjects(1).Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top