EXCEL 实现批量导出图片
- 2022-09-27
- 来源/作者: Wps Office教程网/ 菜鸟图库
- 132 次浏览
Sub ExportPictures()
Dim MyShp As Shape
Dim Filename As String
For Each MyShp In Sheet1.Shapes
If MyShp.Type = msoPicture Then
Filename = ThisWorkbook.Path & "\" & MyShp.Name & ".gif"
MyShp.Copy
With Sheet1.ChartObjects.Add(0, 0, MyShp.Width, MyShp.Height).Chart
.Paste
.Export Filename
.Parent.Delete
End With
End If
Next
Set MyShp = Nothing
End Sub