[英]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.