Opening embedded PDF file in Excel

ColinCoady

New Member
Joined
Mar 21, 2019
Messages
35
I can't find a way to allow a pdf file I open within Excel to open in the foreground in front of Excel. It always opens in the background behind excel workbook. Is there a way around this either by making PDF open in foreground or excel go to background when the pdf opens. I'm not sure if it's a Adobe Reader fix or an excel fix.
Anyone help?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try:

Code:
Sub OpenPdf
    ActiveWorkbook.FollowHyperlink "C:\files\pdf\" & "bill.pdf"
End Sub
 
Upvote 0
My embedded pdf files are put on a sheet as an icon (object icon) and saved with the workbook. If I open the workbook and double click on the icon the pdf opens but behind excel. I add and delete these objects as time goes on and the object number is different each time I add a new one. The sheet may only have 3 or icons on it but the object numbers could be anything and not in sequence. I don't think a formula would work here. Am I wrong?
-Colin
 
Upvote 0
You can select an icon (object icon) and execute the following macro

Code:
Sub [COLOR=#0000ff]Macro1[/COLOR]()
    Selection.Verb Verb:=xlOpen
End Sub

create a short-cut:
Press Alt-F11 to open the VBA editor. From the menu select Insert > Module. On the sheet that opens, paste the code previous.
Close the editor (press Alt-Q).
Press Alt + F8
Select Macro Macro1
Press Options
Type a letter, for example: g
Press OK
Press Ok


Now press Control + g
 
Upvote 0
What would cause this solution to not work when the workbook is copied onto another computer.
When the macro runs on another computer it opens the selected PDF but in behind excel and then gives a run-time error.
-Colin
 
Upvote 0
Excel for Office 365 on both PC's
Adobe Acrobat Reader DC - Ver 2019 on both PC's
Win 7 Pro 32 bit on both PC's

When I run the macro it opens the pdf file and places it in the foreground but the Run-time error '1004' "Cannot start the source application for this object" window also shows up. The Debug shows the single line of code is in yellow.
Works on one PC but not the other. Strange.

I tried it on a Win 10 Pro PC with same versions of Excel & Adobe Reader with different results - the pdf opened in the background with the taskbar shortcut flashing. When I closed out the PDF file, the Excel taskbar icon flashes but no error box shows up. Workbook remained fully functional and flashing stopped when clicked on any sheet.

Any ideas?

-Colin
 
Upvote 0
Unfortunately I do not have the versions to perform tests.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,127
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top