excel表格怎么批量导出图片并以对应单元格命名
发布网友
发布时间:2022-04-23 09:44
我来回答
共1个回答
热心网友
时间:2023-10-09 22:19
使用如下代码可以实现批量操作:
Sub Import_Pic()
On Error Resume Next
Dim my_Chart As ChartObject
Dim my_Sheet As Worksheet
Set my_Sheet = Worksheets(1)
Dim my_Shape As Shape
Dim pic_Num As Single
pic_Num = 1
For Each my_Shape In Worksheets(1).Shapes
Set my_Chart = my_Sheet.ChartObjects.Add(0, 0, my_Shape.Width, my_Shape.Height)
my_Shape.Copy
my_Chart.Chart.Paste
my_Chart.Chart.Export thisworkbook.path & "\" & my_Sheet.Cells(pic_Num + 3, 2) & ".jpg", filtername:="jpg"
pic_Num = pic_Num + 1
my_Chart.Delete
Next
End Sub