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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
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,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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