• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

How to late bind Acrobat object in VBA?

Explorer ,
Jan 29, 2021 Jan 29, 2021

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.

TOPICS
Windows

Views

938

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Feb 02, 2021 Feb 02, 2021

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
...

Likes

Translate

Translate
Explorer ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

Isn't there really anyway for this?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

Maybe nobody knows what BVA is.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2021 Jan 31, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 31, 2021 Jan 31, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2021 Jan 31, 2021

Copy link to clipboard

Copied

I took your advice and made a new post. Hope someone finds it.

https://community.adobe.com/t5/acrobat-sdk/how-to-late-bind-acrobat-object-in-vba/m-p/11798262?page=...

 

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 31, 2021 Jan 31, 2021

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? 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2021 Jan 31, 2021

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.

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 01, 2021 Feb 01, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 01, 2021 Feb 01, 2021

Copy link to clipboard

Copied

I've already seen that section. It doesn't talk about late binding.

 

Thank you for trying to help.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 01, 2021 Feb 01, 2021

Copy link to clipboard

Copied

[Mistake in title fixed]

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 02, 2021 Feb 02, 2021

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

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 02, 2021 Jun 02, 2021

Copy link to clipboard

Copied

LATEST

Thanks - a good working bit of code that should help me get over my own similar problem.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines