Jul 29

Save an Excel chart as a GIF file. Use this script:

Sub savechart()

If TypeName(Selection) = “ChartArea” Then

userFname = InputBox(“Filename of chart” _

& ” file?”, “Save chart”, “excelchart”)

If userFname = “” Then Exit Sub

userNameAndPath = ThisWorkbook.Path & “\” & userFname & “.gif”

ActiveChart.Export Filename:=userNameAndPath, FilterName:=”GIF”

MsgBox “Chart is saved as” & Chr(13) & userNameAndPath

Else

userReply = MsgBox(“Please select a Chart Area, ” _

& “then run macro again”, vbOKOnly, “Error in selection”)

End If

End Sub

Leave a Reply