Hello,
I found the following code that exports charts to a folder but it only it exports one chart even if there is two charts on the same sheet. Can you help please?
Public Sub ExportALLCharts()
Dim outFldr As String
Dim ws As Worksheet
Dim co As ChartObject
outFldr = GetFolder(ActiveWorkbook.Path)
If outFldr = "" Then
MsgBox "Export Cancelled"
Else
For Each ws In ActiveWorkbook.Worksheets
For Each co In ws.ChartObjects
co.Chart.Export outFldr & "\" & ws.Name & ".png", "PNG"
Next co
Next ws
End If
End Sub
Function GetFolder(strPath As String) As String
Dim fldr As FileDialog
Dim sItem As String
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select folder to export all of the Figures to"
.AllowMultiSelect = False
.InitialFileName = strPath
If .Show = True Then sItem = .SelectedItems(1)
End With
GetFolder = sItem
Set fldr = Nothing
End Function
Thanks
Ross
Bookmarks