Note that there are some explanatory texts on larger screens.

plurals
  1. POExport all charts as graphics
    primarykey
    data
    text
    <p>I am trying to find a way to easily export all charts from a workbook in Excel as graphics. I have the following code:</p> <pre><code>Option Explicit Sub ExportChart() ' Export a selected chart as a picture Const sSlash$ = "/" Const sPicType$ = ".png" Dim sChartName$ Dim sPath$ Dim sBook$ Dim objChart As ChartObject On Error Resume Next ' Test if there are even any embedded charts on the activesheet ' If not, let the user know Set objChart = ActiveSheet.ChartObjects(1) If objChart Is Nothing Then MsgBox "No charts have been detected on this sheet", 0 Exit Sub End If ' Test if there is a single chart selected If ActiveChart Is Nothing Then MsgBox "You must select a single chart for exporting ", 0 Exit Sub End If Start: sChartName = Application.InputBox("Please Specify a name for the exported chart" &amp; vbCr &amp; _ "There is no default name available" &amp; vbCr &amp; _ "The chart will be saved in the same folder as this file", "Chart Export", "") ' User presses "OK" without entering a name If sChartName = Empty Then MsgBox "You have not entered a name for this chart", , "Invalid Entry" GoTo Start End If ' Test for Cancel button If sChartName = "False" Then Exit Sub End If ' If a name was given, chart is exported as a picture in the same ' folder location as their current file sBook = ActiveWorkbook.Path sPath = sBook &amp; sSlash &amp; sChartName &amp; sPicType ActiveChart.Export Filename:=sPath, FilterName:="PNG" End Sub </code></pre> <p>This will export the active chart, but how can I export all charts? Bonus points if the charts are named after the worksheet they came from.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload