如何批量导出工作表中的柱状图/折线图等图表为单独图片

原文链接:http://www.excelpx.com/thread-427814-1-1.html

如果图标有标题就输出标题;没有就输出序号

Sub test()
    Dim path As String
    Dim co As ChartObject
    Dim ch As Chart
    path = ThisWorkbook.path & "\"
    For Each co In ActiveSheet.ChartObjects
        Set ch = co.Chart
        ch.Export path & IIf(ch.HasTitle, ch.ChartTitle.Text, "Chart_" & co.Index) & ".png"
    Next
End Sub
Sub test()
    Dim p As String
    Dim sh As Worksheet
    Dim co As ChartObject

    p = ThisWorkbook.Path & "\"
    For Each sh In Sheets
        For Each co In sh.ChartObjects
            co.Chart.Export p & sh.Name & "_Chart" & co.Index & ".png"
        Next co
    Next sh
End Sub
上一篇:超前进位加法器


下一篇:elasticsearch7.1.1【win】下载安装