Pages

Wednesday, January 9, 2013

Macro to export chart as Image


If you want to export chart as image . Try this macro



Sub export_chart()

Dim chrtpth As String

' create a unique Name
chrtpth = ThisWorkbook.Path & "\" & Environ("USERNAME") & VBA.Format(VBA.Now(), "DD_MM_YY_HH_MM_SS") & ".bmp"

'Change chart name which you want to export
Sheets("Sheet1").ChartObjects("Chart 3").Chart.Export chrtpth


' open the image
On Error Resume Next
VBA.Shell "Explorer.exe " & Chr(34) & chrtpth & Chr(34), vbNormalFocus
End Sub



Download working File

No comments:

Post a Comment