Copy link to clipboard
Copied
The following code works perfectly in Microsoft excel VBA.
How can I change it to late binding?
Dim AcroPDDocNew As New Acrobat.AcroPDDoc
Dim AcroPDDocAdd As New Acrobat.AcroPDDoc
Dim lRet As Long
lPages=0
lRet = AcroPDDocNew.Create()
lRet = AcroPDDocAdd.Open("E:\Test1.pdf")
lRet = AcroPDDocNew.InsertPages(lPages - 1, AcroPDDocAdd, 0, 1, True)
Thank you.
It's a shame not only Adobe sells a product and doesn't support the customers, but also doesn't offer enough documetaion on what they promis their software can do.
After days of trial and error, I end up to the following method. I'm not sure if it's the best way to do it, but in a world without documention, anything that works is correct.
The following code, creates a blank file, adds a page and saves it.
It's using Late Binding method.
Dim Ret As Long
Dim AddAfter As Long
Dim DocPageCount As Long
...
Copy link to clipboard
Copied
Isn't there really anyway for this?
Copy link to clipboard
Copied
Maybe nobody knows what BVA is.
Copy link to clipboard
Copied
Unfortunately this forum doesn't allow editing my post.
It was a mistype.
Though the title is mistyped, the contents of the question was correct.
It is VBA not BVA.
VBA is the visual basic language designed for Microsoft Office.
In any office project, if you press alt+F11, you'll be taken to a visual basic editor to write your code and execute a series of functions.
It's very similar to VB (Visual Basic .net) with some restrictions.
If nobody knows about VBA, then in VB is enough for me.
The question is:
How to late bind Acrobat object in VBA.
Copy link to clipboard
Copied
Yes, but now the typo is out there, you cannot make people read a post with a subject they do not understand by adding more replies. People use the subject to skip over posts. This is one occasion where I would advocate making a new post, even if others complain it is a duplicate.
You might also explain WHY you want late binding, whatever that is.
This is not, by the way, an especially busy forum. Replies may take a long time.
Copy link to clipboard
Copied
I took your advice and made a new post. Hope someone finds it.
Is there any way to ask a question directly from the developers?
I think if they sell something, they have to support the product or at least have enough documentation on the correct use of their product.
Thanks again for your time.
Copy link to clipboard
Copied
There was a time you could buy a developer support case for a few hundred dollars, but that seems to have gone away years ago. Do you actually have the documentation?
Copy link to clipboard
Copied
No, I'm looking for the documentaion.
The code you see in my first post above, was taken from a rondom site that came up with a google search.
I downloaded Acrobat SDK and searched it, but I couldn't find a good point to start there either.
Copy link to clipboard
Copied
The Acrobat SDK _is_ the documentation. That's all it is. There are thousands of pages. Tip: look for the "Interapplication communication" section, which is the one which covers OLE.
Copy link to clipboard
Copied
I've already seen that section. It doesn't talk about late binding.
Thank you for trying to help.
Copy link to clipboard
Copied
[Mistake in title fixed]
Copy link to clipboard
Copied
It's a shame not only Adobe sells a product and doesn't support the customers, but also doesn't offer enough documetaion on what they promis their software can do.
After days of trial and error, I end up to the following method. I'm not sure if it's the best way to do it, but in a world without documention, anything that works is correct.
The following code, creates a blank file, adds a page and saves it.
It's using Late Binding method.
Dim Ret As Long
Dim AddAfter As Long
Dim DocPageCount As Long
Dim AcroApp As Object
Dim ResultDoc As Object
Dim AddThisDoc As Object
Set ResultDoc = CreateObject("AcroExch.PDDoc")
Set AddThisDoc = CreateObject("AcroExch.PDDoc")
' Create a blank pdf
Ret = ResultDoc.Create()
' Add the first pdf
AddThisDoc.Open ("D:\File2.pdf")
If ResultDoc.InsertPages(AddAfter - 1, AddThisDoc, 0, AddThisDoc.GetNumPages(), True) = False Then
MsgBox "Failed to Add "
End If
AddAfter = AddAfter + AddThisDoc.GetNumPages()
AddThisDoc.Close
' Add second file
AddThisDoc.Open ("D:\File2.pdf")
DocPageCount = AddThisDoc.GetNumPages()
If ResultDoc.InsertPages(AddAfter - 1, AddThisDoc, 0, DocPageCount, True) = False Then
MsgBox "Failed to Add "
End If
' save result
If ResultDoc.Save(1, "D:\test.pdf") = False Then
MsgBox "Failed to save the file."
End If
ResultDoc.Close
Copy link to clipboard
Copied
Thanks - a good working bit of code that should help me get over my own similar problem.
Copy link to clipboard
Copied
I know this is a bit of a necro, but I figured out how to do this a bit by accident after trying to find an answer here and thought I'd share.
Step 1: Add the adobe object reference in the VBA editor Tools -> References -> Acrobat
Step 2: Open the object browser by hitting F2
Step 3: Look at the top where it says "<All Libraries>" and select "Acrobat"
In the middle of the screen it will show you a list of class objects. Select AcroAVDoc as an example. If you look below the list of class objects and above where the immediate window is you'll see some text that says:
Class AcroAVDoc
Member of Acrobat
AcroExch.AVDoc
That "AcroExch.AVDoc" is what you use with create object IE: CreateObject("AcroExch.AVDoc"). This method of finding the create object command works with any object that would require the new keyword. The other members of the library are things you set with the members that have a create object listing. IE:
Set acroDoc = acroApp.GetPDDoc