Saving a chart as a picture file

  • Thread starter Thread starter Fred
  • Start date Start date
F

Fred

Hi everyone.

It is possible to save a chart as a picture (*.gif, *.jpg,
etc.)?

What I've been doing so far is saving the file as a web
page, opening the page in internet explorer and then
saving the chart as a picture file.

However, when I do this the chart is not saved as a large
file - this method is also too time consuming, since I am
dealing with 70+ charts.

Thanks for any help.

Fred.
 
I think he wants Walkenbach's chart tools:
http://www.j-walk.com/ss/excel/files/charttools.htm

Jon said:
Fred -

You want VBA's Chart.Export method. Here's a sample that saves all the
images on the active sheet in the active workbook's directory.

Sub ExportMyCharts()
Dim MyPath as String
Dim i as Long
MyPath = ActiveWorkbook.Path
For i = 1 to ActiveSheet.ChartObjects.Count
ActiveSheet.Chartobjects(i).Chart.Export _
MyPath & "\Chart" & Format(i, "000") & ".gif", "GIF"
Next
End Sub

- Jon

--
Gary Klass
(e-mail address removed)
Editor, PSRT-L
4600 Politics and Government
Illinois State University
Normal, Illinois 61790
http://LILT.ILSTU.EDU/gmklass
(309) 438-7852
(fax) 438-7638
The Chart of the Week: http://LILT.ILSTU.EDU/gmklass/cow
 
Gary -

Thanks. I intended to mention John's handy addin, but I forgot. I also
presented a bit of code in case the OP wanted to customize the way the
routine worked. Putting the images in the same directory as the
workbook is more convenient that dumping them into My Documents, for
instance.

- Jon
 
Hi,

This is exactly what I want to do a well, but the VBA code doesn't seem
to work on a Mac (OfficeX), giving an error with the code within the
loop. unfortunately I know nothing about VBA, so can't attempt to
correct it. Is it meant to be split over 2 lines? Any suggestions would
be gratefully received

Thanks for your help

Mark
 
Mark -

Sorry, I haven't used a Mac in about 12 years. Anything in OLH that
might help?

The code was meant to be split; the underscore character indicates line
continuation.

- Jon
 
Back
Top