Hi Guys,
I am making a code in VB6 that will combine the 2 PDF Files. This is the code that I just copied in the internet:
Private Sub Command1_Click()
Me.MousePointer = 11
Dim origPdfDoc As Acrobat.CAcroPDDoc
Dim newPdfDoc As Acrobat.CAcroPDDoc
Dim path As String
Dim path2 As String
Dim varNewTotalPages As Long
path = "C:\Users\joem\Desktop\Databook\New Folder\3.pdf"
path2 = "C:\Users\joem\Desktop\Databook\New Folder\4.pdf"
Set origPdfDoc = CreateObject("AcroExch.PDDoc")
Set newPdfDoc = CreateObject("AcroExch.PDDoc")
If origPdfDoc.Open(path) Then
If newPdfDoc.Open(path2) Then
'Get total # of pages too insert
varNewTotalPages = newPdfDoc.GetNumPages
'Insert pages into original pdf
origPdfDoc.InsertPages True, newPdfDoc, 0, varNewTotalPages, False
'Save doc
origPdfDoc.Save PDSaveIncremental, path
Else
MsgBox "Failed to open doc " & path2
End If
'Close docs
origPdfDoc.Close
newPdfDoc.Close
MsgBox "Pages added to " & path
Else
MsgBox "Failed to add pages to " & path
End If
Set origPdfDoc = Nothing
Set newPdfDoc = Nothing
Me.MousePointer = 0
End Sub
I already check the "Adobe Acrobat 9.0 Type Library" but every time I run the program I am always getting this error "ActiveX component can't create object"...Can anybody help me how to solve this?....See attached file for the actual error
I am making a code in VB6 that will combine the 2 PDF Files. This is the code that I just copied in the internet:
Private Sub Command1_Click()
Me.MousePointer = 11
Dim origPdfDoc As Acrobat.CAcroPDDoc
Dim newPdfDoc As Acrobat.CAcroPDDoc
Dim path As String
Dim path2 As String
Dim varNewTotalPages As Long
path = "C:\Users\joem\Desktop\Databook\New Folder\3.pdf"
path2 = "C:\Users\joem\Desktop\Databook\New Folder\4.pdf"
Set origPdfDoc = CreateObject("AcroExch.PDDoc")
Set newPdfDoc = CreateObject("AcroExch.PDDoc")
If origPdfDoc.Open(path) Then
If newPdfDoc.Open(path2) Then
'Get total # of pages too insert
varNewTotalPages = newPdfDoc.GetNumPages
'Insert pages into original pdf
origPdfDoc.InsertPages True, newPdfDoc, 0, varNewTotalPages, False
'Save doc
origPdfDoc.Save PDSaveIncremental, path
Else
MsgBox "Failed to open doc " & path2
End If
'Close docs
origPdfDoc.Close
newPdfDoc.Close
MsgBox "Pages added to " & path
Else
MsgBox "Failed to add pages to " & path
End If
Set origPdfDoc = Nothing
Set newPdfDoc = Nothing
Me.MousePointer = 0
End Sub
I already check the "Adobe Acrobat 9.0 Type Library" but every time I run the program I am always getting this error "ActiveX component can't create object"...Can anybody help me how to solve this?....See attached file for the actual error
Attachments
-
85.8 KB Views: 30