View Single Post
 
Old 04-21-2015, 12:11 PM
JohnWilson JohnWilson is offline Windows 7 64bit Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,914
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Not really a simple way but you could try this (don't throw the old code away - I don't guarantee it will work!)

Code:
Sub PasteSlides()
Dim filenum As Integer
Dim strBuffer As String
Dim rayData() As String
Dim oLib As Presentation
Dim raySlides() As Long
Dim L As Long
Dim x As Long
filenum = FreeFile
' change to your text file location
Open "C:\Users\John\Desktop\data.txt" For Input As filenum
While Not EOF(filenum)
    Line Input #filenum, strBuffer
    rayData = Split(strBuffer, ",")
    Set oLib = Presentations.Open(FileName:=rayData(0), WithWindow:=False)
    ReDim raySlides(1 To rayData(2) - rayData(1) + 1)
    For L = CLng(rayData(1)) To CLng(rayData(2))
        x = x + 1
        raySlides(x) = L
    Next L
    oLib.Slides.Range(raySlides).Copy
    oLib.Close
    ActivePresentation.Windows(1).Activate
    CommandBars.ExecuteMso ("PasteSourceFormatting")
    DoEvents
    x = 0
Wend
End Sub
You will probably find you do NOT need quotes in the textfile
C:\Users\John\Desktop\Pres 1.pptx,1,1
C:\Users\John\Desktop\Pres 2.pptx,2,3

If there is always just ONE slide to paste from each file that will make it easier.
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote