簡體   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