Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim docOBJ As Variant
- Dim loopCounter As Integer
- Dim numberOfPages As Integer
- Debug.Print collectionOfAddresses.Count & " addresses accepted"
- For Each localAddress In collectionOfAddresses
- Dim localDocument As Acrobat.CAcroPDDoc
- Set localDocument = CreateObject("AcroExch.PDDoc")
- collectionOfDocs.Add localDocument
- Dim currentCollectionPos As Integer
- currentCollectionPos = collectionOfDocs.Count
- Debug.Print "Opening " & localAddress
- collectionOfDocs(currentCollectionPos).Open (localAddress)
- Next localAddress
- Debug.Print ("Created localDocObjects " & collectionOfDocs.Count)
- Debug.Print collectionOfDocs(1).GetFileName() & " has " & collectionOfDocs(1).GetNumPages() & " pages"
- For loopCounter = 2 To collectionOfAddresses.Count
- numberOfPages = collectionOfDocs(1).GetNumPages()
- If (collectionOfDocs(1).InsertPages(0, collectionOfDocs(loopCounter), 0, 1, True)) Then MsgBox "Error"
- Debug.Print "loopCounter: " & loopCounter
- Debug.Print "numberOfPages: " & numberOfPages - 1
- Debug.Print "Appending: " & collectionOfDocs(loopCounter).GetFileName()
- Debug.Print "Number of pages appending: " & collectionOfDocs(loopCounter).GetNumPages()
- Debug.Print collectionOfDocs(loopCounter).GetFileName() & " has " & collectionOfDocs(loopCounter).GetNumPages() & " pages"
- Next loopCounter
- Dim newBinderPath As String
- newBinderPath = ActiveWorkbook.Path & "Binder.pdf"
- If collectionOfDocs(1).Save(PDSaveFull, newBinderPath) = False Then MsgBox "Cannot save the modified document"
- End Sub
- Sub testMergePDFList()
- Dim addressCollection As New Collection
- addressCollection.Add "Y:CompletionsEngineers Toolbox2017 Platform2017 platform Standard Well Program TXT.pdf"
- addressCollection.Add "Y:CompletionsEngineers Toolbox2017 PlatformKropp 1H 15 Stage Pump Schedule.pdf"
- Call mergePDFList(addressCollection)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement