office交流网--QQ交流群号

Access培训群:792054000         Excel免费交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

导出Excel工作表中所有形状为图片,要经过ChartObjects的转换

2021-01-29 08:00:00
zstmtony
原创
2821

导出Excel工作表中所有形状为图片,要经过ChartObjects的转换。相关的代码如下


Dim shp As Shape


For Each shp In ActiveSheet.Shapes
        shp.CopyPicture
        ActiveSheet.Paste
            With ActiveSheet.ChartObjects.Add(0, 0, shp.Width, shp.Height).Chart
                .Paste
                .Export "D:\Export" & shp.Name & ".jpg", "JPG"
                Selection.Delete
                .Parent.Delete
            End With

Next
分享