Craig Johnson
asked on
Merge PDF Question
Thoughts as to why this is giving an error "Run-time error '438' Object doesn't support this property or method" The debugger says the error is on "AcroExch.App").
Thx
CWJ
---------------------
Sub Merge_PDF()
Dim AcroExchApp As Acrobat.CAcroApp
Dim AcroExchPDDoc As Acrobat.CAcroPDDoc
Dim AcroExchInsertPDDoc As Acrobat.CAcroPDDoc
Dim strFileName As String, strPath As String
Dim iNumberOfPagesToInsert As Integer
Dim iLastPage As Integer
Set AcroExchApp = CreateObject("AcroExch.App ")
Set AcroExchPDDoc = CreateObject("AcroExch.PDD oc")
AcroExchApp = CreateObject("AcroExch.App ")
AcroExchPPDoc = CreateObject("AcroExch.PDD oc")
AcroExchApp.Show
strFileName = "C:\1.pdf"
AcroExchPDDoc.Open (strFileName)
iLastPage = AcroExchPDDoc.GetNumPages( ) - 1
AcroExchInsertPDDoc = CreateObject("AcroExch.PDD oc")
AcroExchInsertPDDoc.Open ("C:\2.pdf")
iNumberOfPagesToInsert = AcroExchInsertPDDoc.GetNum Pages
AcroExchPDDoc.InsertPages iLastPage - 1, AcroExchInsertPDDoc, 0, iNumberOfPagesToInsert, True
AcroExchInsertPDDoc.Close
AcroExchPDDoc.Save PDDocRequiresFullSave, "C:\merged.pdf"
AcroExchPDDoc.Close
AcroExchApp.Exit
AcroExchInsertPDDoc = Nothing
AcroExchPDDoc = Nothing
AcroExchApp = Nothing
End Sub
---------------------
Thx
CWJ
---------------------
Sub Merge_PDF()
Dim AcroExchApp As Acrobat.CAcroApp
Dim AcroExchPDDoc As Acrobat.CAcroPDDoc
Dim AcroExchInsertPDDoc As Acrobat.CAcroPDDoc
Dim strFileName As String, strPath As String
Dim iNumberOfPagesToInsert As Integer
Dim iLastPage As Integer
Set AcroExchApp = CreateObject("AcroExch.App
Set AcroExchPDDoc = CreateObject("AcroExch.PDD
AcroExchApp = CreateObject("AcroExch.App
AcroExchPPDoc = CreateObject("AcroExch.PDD
AcroExchApp.Show
strFileName = "C:\1.pdf"
AcroExchPDDoc.Open (strFileName)
iLastPage = AcroExchPDDoc.GetNumPages(
AcroExchInsertPDDoc = CreateObject("AcroExch.PDD
AcroExchInsertPDDoc.Open ("C:\2.pdf")
iNumberOfPagesToInsert = AcroExchInsertPDDoc.GetNum
AcroExchPDDoc.InsertPages iLastPage - 1, AcroExchInsertPDDoc, 0, iNumberOfPagesToInsert, True
AcroExchInsertPDDoc.Close
AcroExchPDDoc.Save PDDocRequiresFullSave, "C:\merged.pdf"
AcroExchPDDoc.Close
AcroExchApp.Exit
AcroExchInsertPDDoc = Nothing
AcroExchPDDoc = Nothing
AcroExchApp = Nothing
End Sub
---------------------
WHich version of Acrobat are you using? I assume you know that this program requires the full version of Acrobat to be installed.
ASKER
Version 7.0...Yes full version
CWJ
CWJ
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Pro
ASKER
I will likely be merging 10-20 PDF's with this code. Any streamlining thoughts would be appreciated...
CWJ