繁体   English   中英

图表表复制并粘贴到电源点

[英]Chart sheet copy and pasted to power point

您好,我正在尝试将许多图表表复制并粘贴到 PowerPoint 中,每个图表表都有自己的幻灯片。

此代码只会在工作表中使用图表而不是图表。

我在网上找到了大部分代码并对其进行了修改,以便将图表作为 png 图像粘贴到幻灯片中。 如何更改它,以便我可以遍历所有图表并将它们传递到 excel。 我也想从左图开始,从左到右循环。

 Sub ExportChartsToPowerPoint_MultipleWorksheets()



    ' OVERVIEW:

    ' This script will loop through all the worksheets in the Active Workbook

    ' and copy all the Charts to a new PowerPoint presentation that we create.

    ' Each chart will get their own individual slide and will be placed in the center of it.



    'Declare PowerPoint Variables

    Dim PPTApp As PowerPoint.Application

    Dim pptPres As PowerPoint.Presentation

    Dim PPTSlide As PowerPoint.Slide

    Dim PPTShape As PowerPoint.Shape

    Dim SldIndex As Integer



    'Declare Excel Variables

    Dim Chrt As ChartObject
    Dim Chart As Chart
    Dim WrkSht As Worksheet


    'Create new PowerPoint Application & make it visible.

    Set PPTApp = New PowerPoint.Application

        PPTApp.Visible = True


    'Create new presentation in the PowerPoint application.

    Set pptPres = PPTApp.Presentations.Add


    'Create an index handler for slide creation.

    SldIndex = 1


    For Each WrkSht In Worksheets


        'Loop through all the CHARTOBJECTS in the ACTIVESHEET.

        For Each Chrt In WrkSht.ChartObjects



            'Copy the Chart

            Chrt.Copy


            'Create a new slide in the Presentation, set the layout to blank, and paste chart on to the newly added slide.

            Set PPTSlide = pptPres.Slides.Add(SldIndex, ppLayoutBlank)

                PPTSlide.Shapes.PasteSpecial DataType:=ppPastePNG



            'Increment index so that way we paste the next chart on the new slide that is added.

            SldIndex = SldIndex + 1



        Next Chrt


      Next WrkSht
End Sub

我最近经历了从图表表中复制和粘贴图表到 word doc。 我最终不得不以 go 的方式来讨论它,但我发现从图表表中复制/粘贴图表的唯一方法就是这样做..

Charts("Name Of Chart Sheet").Select
Selection.Copy

然后,您可以将 go 粘贴到您要查看的任何位置。 否则,当我复制它时,它会制作一个带有新图表的新工作簿。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM