PDA

View Full Version : Solved: How to export an excel chart as a jpeg



lneilson
08-14-2008, 05:55 PM
Hi

How do I save a chart named "chart 1 " to a folder located

G:\charts as a jpeg file

thanks

lneilson

lneilson
08-14-2008, 06:16 PM
Hi

solved this one by doing a alt /prnt scr
opened photoshop opened new blank canvas
pasted and resized and save a copy as a jpeg

lneilson

Kenneth Hobs
08-14-2008, 06:56 PM
If you need to automate it, you can use Export.

e.g. GIF
Private Sub UpdateChart()
Dim currentchart As Chart, Fname As String, ChartNum as integer
ChartNum=1
Set currentchart = Sheets("Charts").ChartObjects(ChartNum).Chart
currentchart.Parent.Width = 400
currentchart.Parent.Height = 200

' Save chart as GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & _
currentchart.name & ".gif" _
currentchart.Export Filename:=Fname, FilterName:="GIF"
End Sub

lneilson
08-15-2008, 07:44 AM
thanks for the reply

will this work in excel 2000
and how do I save to a folder outside excel such as G:\Charts

lneilson

Kenneth Hobs
08-15-2008, 07:51 AM
I don't have 2000 installed to test. If you do, you can try it and see. If it works, you can save to any path.

e.g.

Private Sub UpdateChart()
Dim currentchart As Chart, Fname As String, ChartNum As Integer
ChartNum=1
Set currentchart = Sheets("Charts").ChartObjects(ChartNum).Chart
currentchart.Parent.Width = 400
currentchart.Parent.Height = 200

' Save chart as GIF
Fname = "G:\Charts\SomeChartName\" & ".gif"
currentchart.Export Filename:=Fname, FilterName:="GIF"
End Sub