小编fro*_*ove的帖子

将所有图表导出为图形

我试图找到一种方法轻松导出Excel中的工作簿中的所有图表作为图形.我有以下代码:

Option Explicit

Sub ExportChart()
     '   Export a selected chart as a picture
    Const sSlash$ = "/"
    Const sPicType$ = ".png"
    Dim sChartName$
    Dim sPath$
    Dim sBook$
    Dim objChart As ChartObject


    On Error Resume Next
     '   Test if there are even any embedded charts on the activesheet
     '   If not, let the user know
    Set objChart = ActiveSheet.ChartObjects(1)
    If objChart Is Nothing Then
    MsgBox "No charts have been detected on this sheet", 0
    Exit Sub
    End If


     '   Test if …
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

0
推荐指数
1
解决办法
3457
查看次数

标签 统计

excel ×1

excel-vba ×1

vba ×1