iJerry
03-26-2018, 02:31 AM
Hiii vba express friends, still new to this forum but i need help. :(
I am really new to this powerpoint vba.
I want to paste my slides from presentation 1 to presentation 2 but after a slide with specific text like ("4a) Marketing").
But I am trap in an infinite loop. Please Help :(
Sub test2()
Dim OldPPT As PowerPoint.Presentation
Dim NewPPT As PowerPoint.Presentation
Dim pp AsObject
Dim sld As Slide
Dim shp As Shape
Set pp = GetObject(,"PowerPoint.Application")
Set OldPPT = pp.ActivePresentation
Set NewPPT = pp.Presentations("Testing.pptm")
ForEach sld In NewPPT.Slides
ForEach shp In sld.Shapes
If shp.HasTextFrame Then
If shp.TextFrame.TextRange.Find("4a"&")"&"Marketing")IsNothingThen
Else
For k =2To OldPPT.Slides.Count
ActivePresentation.Slides(k).Copy
NewPPT.Slides.Paste
Next
EndIf
EndIf
Next shp
Next sld
EndSub
I am really new to this powerpoint vba.
I want to paste my slides from presentation 1 to presentation 2 but after a slide with specific text like ("4a) Marketing").
But I am trap in an infinite loop. Please Help :(
Sub test2()
Dim OldPPT As PowerPoint.Presentation
Dim NewPPT As PowerPoint.Presentation
Dim pp AsObject
Dim sld As Slide
Dim shp As Shape
Set pp = GetObject(,"PowerPoint.Application")
Set OldPPT = pp.ActivePresentation
Set NewPPT = pp.Presentations("Testing.pptm")
ForEach sld In NewPPT.Slides
ForEach shp In sld.Shapes
If shp.HasTextFrame Then
If shp.TextFrame.TextRange.Find("4a"&")"&"Marketing")IsNothingThen
Else
For k =2To OldPPT.Slides.Count
ActivePresentation.Slides(k).Copy
NewPPT.Slides.Paste
Next
EndIf
EndIf
Next shp
Next sld
EndSub