VBA Embedding a PDF - No Do Over's? :-S

smason48

New Member
Joined
Jan 12, 2010
Messages
15
When using the code below, it lets me select a PDF file to import, it does it and it works great, HOWEVER, if the person were to delete that PDF and run it again (for example an updated version of the same file) it seems to only show me a blank square box. It seems its storing something however upon inspection the file size hasnt changed and Excel doesnt claim that there are any special objects.

Any ideas? Ideally I'd like to be able to import a file, then if deleted, when the same file is reimported for it to act as it did first time.

Code:
 Sub ImportAttachment2()
    Range("A2").Select
ActiveSheet.OLEObjects.Add(classtype:="AcroExch.Document.7", link:=False, DisplayAsIcon:=False).Select
    Selection.Name = "Attachment 2"
'MsgBox ("File Import Completed")
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,215,881
Messages
6,127,527
Members
449,385
Latest member
KMGLarson

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