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

Error When Embedding A PDF File with Excel VBA (Win 7 SP1, Office 2010, Acrobat X Standard)

New Here ,
Mar 01, 2016 Mar 01, 2016

Hello,

when trying to embed PDF files via Excel VBA, I encounter a 1004 Runtime Error ("Can't insert object") caused by the OLEObjects.Add method on specific computers. I've searched the internet thoroughly but didn't find a workable solution for the problem. Embedding is no problem with the computer I used to develop the tool and with other computers with the same configuration (comparison: see below). On the problematic machines it is possible to manually embed PDF files.

Delevopment System And Other Systems On Which Code Works

Win 7 Enterprise SP1 32-Bit

Excel 2010

Acrobat Reader XI

Problematic Systems

Acrobat X Standard, rest the same

Code Line That Causes The Error

    Set objAttachment = ThisWorkbook.Worksheets(strSheetSignOff).OLEObjects.Add _

(Filename:=FileToEmbed, Link:=False, DisplayAsIcon:=True, IconFileName:=AppForIcon, IconIndex:=0, _    

IconLabel:=NameOfFileToEmbed, Left:=dblAttLeft, Top:=AttachmentOffsetTop)

The variables are unproblematic, I tried to use fixed values without success.

Do you have any idea what the problem might be? In one forum I found the solution to a similar problem to be the replacement of Acrobat Reader by a PDF reader from a different developer - well, this is no option in my case. I suppose that there's a specific problem with the different Acrobat version installed, but I've got no idea what is the root cause and how to solve this.

Thanks a lot in advance.

Cheers

Günther

TOPICS
Acrobat SDK and JavaScript , Windows
1.3K
Translate
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
no replies

Have something to add?

Join the conversation