簡體   English   中英

如何將文本從 Word 文檔復制到 PowerPoint 並進行演示

[英]How copy Text from Word document to PowerPoint and make a Presentation

美好的一天,我有一個問題,我知道如何將圖片或形狀從 MS Word 復制到 PPT 並進行演示。 但是我無法理解如何對文本做同樣的事情。

最初的想法是通過段落復制。 它有標題,不是一個而是多個,以及每個標題的正文。 我首先創建了一個演示文稿並添加了一張幻燈片。 我想遍歷打開的 Word 文檔中的所有文本並將其復制到 PP 標題到標題和正文到 PP 演示文稿的主文本框。 將不勝感激任何幫助

 Sub WordToPPt()
    Dim PPTApplication As PowerPoint.Application
    Dim activeSlide As PowerPoint.Slide
        
    On Error Resume Next
    Set PPTApplication = GetObject(, "PowerPoint.Application")
    On Error GoTo 0
 
    If PPTApplication Is Nothing Then
        Set newPowerPoint = New PowerPoint.Application
    End If

    If PPTApplication.Presentations.Count = 0 Then
        PPTApplication.Presentations.Add
    End If
 
    PPTApplication.Visible = True
End Sub

樣品https://imgur.com/ElvJoC1另一個https://imgur.com/Lc9PQql

我已經設法通過 Styles 識別段落,因為它們都是不同的

If ActiveDocument.Paragraphs(J).Style = ("STYLE_NAME") Then

但是,當我想在插入剪切幻燈片時制作相反的幻燈片順序時遇到了另一個問題

Dim SlidesNumber As Long Dim x As Long

   SlidesNumber = mypresentation.Slides.Count

        For x = 1 To SlidesNumber - 1

          ' Reorder the slides.
          mypresentation.Slides(SlidesNumber).Cut
          mypresentation.Slides.Paste SlidesNumber 'here is where the problem pops out
       Next x
    End If

繼續獲取Slides.Paste:請求無效。 剪貼板為空或包含可能無法在此處粘貼的數據

有人可以解釋為什么它開始工作幾次,然后停止工作。 解決方案是什么?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM