Embedded PDF opens in background

ftcjim

New Member
Joined
Jun 24, 2007
Messages
4
I made a Excel s[read sheet with about 50 worksheets, each represents a author. Sheet 2 has a PDF embedded with synopsis for a number of books. I wanted a button on each worksheet that when clicked it would refer back to sheet 2 and open the PDF. The code I made is :
Sub OpenPdf()
'
' OpenPDF Macro
'

'
Sheets("Synopsis").Select
ActiveSheet.Shapes.Range(Array("Object 3")).Select
Selection.Verb Verb:=xlPrimary
End Sub

This works fine. The problem is the PDF opens in the background. Is there a way to add or modify in order to resolve the open in background issue.
Thanks
JIm
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Try this one-liner:
VBA Code:
    Worksheets("Synopsis").OLEObjects("Object 3").Verb Verb:=xlVerbOpen
 
Upvote 0
Thanks John, that worked fine but it also brought up an error box. It did bring up the PDF in foreground and Adobe Acrobat did open it.
1583021071240.png
 
Upvote 0
This should open the PDF without error:
VBA Code:
Sub Open_PDF()
    On Error Resume Next
    Worksheets("Synopsis").OLEObjects("Object 3").Verb Verb:=xlVerbOpen
    On Error GoTo 0
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,254
Messages
6,123,893
Members
449,132
Latest member
Rosie14

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