Question

Problem: embedded a PDF into a Excel workbook. This PDF is a feedback form which has a send to mail recipient button. Without embedding it to Excel sending works, when embedded sending causes Excel to crash.

My idea is to open the OLEObject, save the embedded PDF temporary, close the OLEObject and open the saved PDF so that it runs in a Acrobat instance. Opening the OLEObject already works by using:

ThisWorkbook.Sheets(SheetName).Shapes(OLE_Name).Select
Selection.Verb Verb:=xlOpen

But im struggling with the following steps. How to do this? Possible other ways?

WIN7, Office 2010, Acrobat Reader

Was it helpful?

Solution

OK. OLEObjects are notoriously difficult to work with. I have done some searching because it seems hard to believe this is not supported. This was my first attempt to use a Shell command to copy the OLE and paste it to a known directory.

However, you can't copy/paste a PDF embedded object, which means you can't use a Shell command to copy/paste it to a temporary folder/file path. So that won't work.

The consensus seems to be that this is not really possible; all you can do with embedded PDF is open them. See here and, here which referencing this PDF says:

See the "AxAcroPDFLib.AxAcroPDF" section under OLE Automation. Those are the only methods you have available to you from Reader

And also, here:

What you are doing relies on you knowing how to interact with the particular class which may be OK if you only have a couple of types and know what they are but in general, unless (a) the Class supports Automation and (b) you know the commands to issue this can't work.

The class does not really support the sort of automation you desire.

Possible Solution

Use Acrobat and WinAPI

If you have Acrobat installed, then I believe you may be able to do this possibly using WinAPI to get the hWnd of the Acrobat instance, and control it that way. I have perused some documentation, but I do not have Acrobat and so I am not able to test.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top