muhammad susanto
Well-known Member
- Joined
- Jan 8, 2013
- Messages
- 2,077
- Office Version
- 365
- 2021
- Platform
- Windows
dear all.
i found below code to extract chart into a folder, i want someone would help me to modify this code to can extract all images into a folder e.g. folder c:/extract
my images in .jpg and .png format.
here this code:
any body home would help me, greatly appreciated..
.sst
i found below code to extract chart into a folder, i want someone would help me to modify this code to can extract all images into a folder e.g. folder c:/extract
my images in .jpg and .png format.
here this code:
VBA Code:
Sub ExportAllCharts()
Dim objShell As Object
Dim objWindowsFolder As Object
Dim strWindowsFolder As String
Dim objSheet As Excel.Worksheet
Dim objChartObject As Excel.ChartObject
Dim objChart As Excel.Chart
'Select a Windows folder
Set objShell = CreateObject("Shell.Application")
Set objWindowsFolder = objShell.BrowseForFolder(0, "Select a Windows folder:", 0, "")
If Not objWindowsFolder Is Nothing Then
strWindowsFolder = objWindowsFolder.self.Path & "\"
For i = ThisWorkbook.Worksheets.Count To 1 Step -1
Set objSheet = ThisWorkbook.Worksheets(i)
If objSheet.ChartObjects.Count > 0 Then
For Each objChartObject In objSheet.ChartObjects
Set objChart = objChartObject.Chart
objChart.Export strWindowsFolder & objChart.Name & ".jpg"
Next
End If
Next
'Open the windows folder
Shell "Explorer.exe" & " " & strWindowsFolder, vbNormalFocus
End If
End Sub
any body home would help me, greatly appreciated..
.sst