|
本帖最后由 excel.x 于 2020-7-13 15:21 编辑
VSTO中,保存工作表中图片对象,功能实现不了呢。哪位前辈指点下,感谢。
Dim Shp As Excel.Shape
Dim SavePath As String
With app.FileDialog(Microsoft.Office.Core.MsoFileDialogType.msoFileDialogFolderPicker)
If .Show = -1 Then SavePath = .SelectedItems(0) Else Exit Sub
End With
If Right(SavePath, 1) <> "\" Then SavePath = SavePath & "\"
With app.ActiveSheet
If .Shapes.Count < 1 Then
Exit Sub
End If
For i = 1 To .Shapes.Count
Shp=.Shapes.(i) ’ shp=.Shapes.item(i)
Shp.Copy()
With .chartobjects.add(0, 0, Shp.Width + 28, Shp.Height + 30).chart
.paste
.export(SavePath & Shp.Name & ".JPG", "JPG")
.parent.delete
End With
Next
End With
|
|