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. 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. 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
I have managed to identify paragraphs by Styles as they are all different
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
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. 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?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.