Copy link to clipboard
Copied
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
Have something to add?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more