Hi,
I'd like to be able to save all Charts in a sheet with their Chart Title as their name, for some reason this is proving more difficult than expected.
I believe it's the Title = part of the code that needs to be changed.
Any help would be appreciated.
Code:
Sub ExportSheetCharts()
'Create a variable to hold the path and name of image
Dim cht As ChartObject
Dim strUserName As String
Dim Title As String
strUserName = Application.UserName
Title = ChartObject.ChartTitle
ActiveSheet.ChartObjects.Select
'Export the chart
For Each cht In ActiveSheet.ChartObjects
cht.Chart.Export "C:\Users\" & strUserName & "\Pictures\" & Title & x & ".png"
x = x + 1
Next cht
End Sub
Thanks,
I'd like to be able to save all Charts in a sheet with their Chart Title as their name, for some reason this is proving more difficult than expected.
I believe it's the Title = part of the code that needs to be changed.
Any help would be appreciated.
Code:
Sub ExportSheetCharts()
'Create a variable to hold the path and name of image
Dim cht As ChartObject
Dim strUserName As String
Dim Title As String
strUserName = Application.UserName
Title = ChartObject.ChartTitle
ActiveSheet.ChartObjects.Select
'Export the chart
For Each cht In ActiveSheet.ChartObjects
cht.Chart.Export "C:\Users\" & strUserName & "\Pictures\" & Title & x & ".png"
x = x + 1
Next cht
End Sub
Thanks,