Export Sheet Charts to PNG files

Evripos

New Member
Joined
Mar 3, 2011
Messages
16
Hi and a Happy Thanksgiving to all.
I have a workbook where I have created eight individual sheet-charts. The naming of these sheet-charts starts with "Data_1" and ends with "Data_8". I would like to be able to export them in .PNG format and in the same directory as my Excel workbook file by using VBA code. I have found many websites and videos online where they show how to export chart objects from the same or different worksheets in the same workbook. Unfortunately, I am not looking for that. My charts are individual worksheet-charts in the same workbook.

Thank you for your help and effort.

Evripos
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try the following code...

VBA Code:
Sub ExportChartSheets()

    Dim destinationPath As String
    Dim index As Long
    
    destinationPath = ThisWorkbook.Path & "\"
    
    For index = 1 To 8
    
        ThisWorkbook.Charts("Data_" & index).Export _
            Filename:=destinationPath & "Data_" & index & ".png", _
            FilterName:="PNG"
        
    Next index

End Sub

Hope this helps!
 
Upvote 0
Solution

Forum statistics

Threads
1,225,482
Messages
6,185,253
Members
453,283
Latest member
Shortm88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top