Insert pdf into cell

gsandy

New Member
Joined
Aug 31, 2008
Messages
5
I have used the code below to insert a pdf graphic into a spreadsheet:
Code:
Worksheets("PrintQRLabels").OLEObjects.Add Filename:=ActiveWorkbook.Path & "\101.pdf", Link:=False, DisplayAsIcon:=False, Left:=140, Top:=1, Width:=150, Height:=10
Instead of positioning the graphic by "Top" and "Left" I wish to insert by reference to a cell (numerous graphics are being inserted by a loop).
How can I modify the above code to insert into a cell?
Thanks Sandy.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Untested but you might try something like this:

Left:= Range("A1").Left
Width:= Range("A1").Width
Height:= Range("A1").Height
 
Upvote 0
Thanks JoeMo. Your code works but it always puts the pdf in the first row!

This code puts the pdf into cell A1:
Code:
Worksheets("PrintLabels").OLEObjects.Add Filename:=ActiveWorkbook.Path & "\101.pdf", Link:=False, _
DisplayAsIcon:=False, Left:=Range("A5").Left, Top:=1, Width:=Range("A5").Width, Height:=Range("A5").Height

This code puts the pdf into cell B1:
Code:
Worksheets("PrintLabels").OLEObjects.Add Filename:=ActiveWorkbook.Path & "\101.pdf", Link:=False, _
DisplayAsIcon:=False, Left:=Range("B5").Left, Top:=1, Width:=150, Height:=10
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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