Open embedded object pdf file using VBA

panama2134

New Member
Joined
Feb 1, 2022
Messages
2
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2010
Platform
  1. Windows
  2. Web
Hello and Thank you in advance,

I have an excel sheet with several PDF Forms embedded as objects, when the sheet is protected I cant click on it, therefore I'm looking for a VBA code that will allow me to click on the object AND THE pdf WILL OPEN.

This is what I have so far, and it works ok but after the file is open I get a (400 error message in excel)

Sub test2()
With ActiveSheet
Set o = .OLEObjects("Object 2")
o.Verb xlVerbOpen
End With
End Sub

I looked and looked and don't seem to be able to find a Code that could help me get this done.

Thank you Again
 

Attachments

  • 2022-02-01 19_52_10-BUNK ROSTERS (version 1) - Excel.png
    2022-02-01 19_52_10-BUNK ROSTERS (version 1) - Excel.png
    91.8 KB · Views: 26

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Unless it's a trusted locations issue, or that the correct app (or version) isn't registered for the object, I don't know.

Isn't it "affidavit"?
 
Upvote 0
no trusted location they are just blank form embedded into a spreadsheet for fast access
 
Upvote 0
I used the same code but for a command button. it does open my embedded ojbect, a PDF in this case, but i do get an error and it highlights to debug the following line:

o.Verb xlVerbOpen

This is my full code:

VBA Code:
Private Sub CommandButton4_Click()
With ActiveSheet
Set o= .OLEObjects("object 15")
o.Verb xlVerbOpen
End With
End Sub

The error that I am getting is: Run-time error '1004': Cannot start the source application for this object.

Any help with this would be appreciated
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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