简体   繁体   English

如何将文本从 Word 文档复制到 PowerPoint 并进行演示

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

Good Day, I have a problem, i know how to copy a picture or a shape from MS Word to PPT and making a presentation.美好的一天,我有一个问题,我知道如何将图片或形状从 MS Word 复制到 PPT 并进行演示。 however couldn't get my head around how to do the same with text.但是我无法理解如何对文本做同样的事情。

The original idea was to copy via Paragraphs.最初的想法是通过段落复制。 It has titles, not one but many, and main text for each title.它有标题,不是一个而是多个,以及每个标题的正文。 I started by creating a presentation and adding a slide.我首先创建了一个演示文稿并添加了一张幻灯片。 I would like to loop through all text in Word Document opened and copy it to PP title to title and main text to main textbox of PP presentation.我想遍历打开的 Word 文档中的所有文本并将其复制到 PP 标题到标题和正文到 PP 演示文稿的主文本框。 Would appreciate any help将不胜感激任何帮助

 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

Samples https://imgur.com/ElvJoC1 another one https://imgur.com/Lc9PQql样品https://imgur.com/ElvJoC1另一个https://imgur.com/Lc9PQql

I have managed to identify paragraphs by Styles as they are all different我已经设法通过 Styles 识别段落,因为它们都是不同的

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

however faced another problem when I want to make a reverse order of slides when insert the cut slide但是,当我想在插入剪切幻灯片时制作相反的幻灯片顺序时遇到了另一个问题

Dim SlidesNumber As Long Dim x As Long 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

keep on getting Slides.Paste: Invalid request.继续获取Slides.Paste:请求无效。 Clipboard is empty or contains data which may not be pasted here剪贴板为空或包含可能无法在此处粘贴的数据

Can someone explain why it worked first few times and stopped working after that.有人可以解释为什么它开始工作几次,然后停止工作。 And what would be the solution?解决方案是什么?

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

相关问题 将 PowerPoint 演示文稿中的评论导出到 Word 文档的表格中 - Export comments from a PowerPoint presentation in a table of a Word document 如何从MS Word复制/粘贴文本框到Powerpoint幻灯片? - How to Copy/Paste text box from MS Word to Powerpoint slide? VBA POWERPOINT:将带有格式的文本从Powerpoint复制到单词 - VBA POWERPOINT: Copy text with formatting from powerpoint to word 如何以编程方式将图片从Word复制到Powerpoint? - How to copy picture from Word to Powerpoint programmatically? 从 Word VBA 编辑 PowerPoint 演示文稿页脚 - Editing PowerPoint presentation footer from Word VBA 从 PowerPoint 演示文稿(VBA、powerpoint)打开 Excel 文档 - Open Excel document from a powerpoint presentation (VBA, powerpoint) 将VBA与Powerpoint一起使用可在Word Doc中搜索标题并将文本复制到另一个Word文档中 - Use VBA with Powerpoint to Search titles in a Word Doc and Copy Text into another Word Document 将文本从Excel中的范围复制到Word文档 - Copy Text from Range in Excel into Word Document 在另一个 Powerpoint 演示文稿中嵌入来自其他 Powerpoint 演示文稿的幻灯片的链接副本 - Embed a linked copy of a slide from other Powerpoint presentation in another Powerpoint presentation 如何在 VBA 中将形状从一个 Powerpoint 演示文稿复制到另一个? - How do I copy a Shape from one Powerpoint presentation to another in VBA?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM