I tried to export images using vba
but the image that was successfully exported cannot be opened
any idea ?
but the image that was successfully exported cannot be opened
any idea ?
VBA Code:
Sub example()
Dim y As Integer, i As Integer, x As Integer
Dim DirFile As String
On Error Resume Next
MkDir "C:\image\"
y = Sheet17.Range(Sheet17.Range("E2"), Sheet17.Range("A2").End(xlDown)).Count + 1
For i = 2 To y
For x = 5 To 12
With Sheets("download").Shapes.Range(Array("Chart 2"))
If Sheet17.Cells(i, x).Value <> "" Then
.Fill.UserPicture Sheet17.Cells(i, x).Value
.Chart.Export "C:\image\" & i - 1 & "-" & x - 4 & ".jpeg"
End If
End With
Next x
Next i
End Sub