繁体   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