Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert PDF file into Word 2000 Doc

Status
Not open for further replies.

jadams0173

Technical User
Feb 18, 2005
1,210
In the middle of a project I've been thrown a curve by the requester. They have just told me that on several occasions they insert other files into the word document like this. Insert > Object > Create from File > Browse > Select File and then they check the Display as Icon box.

I recorded a macro to see how I was to go about this and here is what I got.
Code:
    Selection.InlineShapes.AddOLEObject ClassType:="AcroExch.Document.7", _
        FileName:="C:\documents\AAA beach directions.pdf", LinkToFile:=False, _
        DisplayAsIcon:=True, IconFileName:= _
        "C:\WINDOWS\Installer\{AC76BA86-7AD7-1033-7B44-A80000000002}\PDFFile_8.ico" _
        , IconIndex:=0, IconLabel:="""AAA beach directions.pdf"""

Can this be done any better? A little reading here suggests that the macro recorder and InlineShapes are not always best friends. Some posts suggested there were limitations of inlineshapes when using the macro recorder.

Any thoughts?
 
Depends on how you are implenting it into your code, is it going to be a macro the user runs and it inserts the pdf at that point in the document, or is it part of a bigger routine. ?

Chance,

F, G + HH
 
It's part of a bigger routine. I'm actually going to try and run the code from VB6. I'm populating a word doc full of bookmarks and text form fields. Last minute I get the above request to add this functionality. I've got a VB6 class that does the work of populates the doc, and somehow I hope to incorperate this in it. But I generally try to start with a VBA macro and massage the code from there.
 
How about inserting a table and then adding the pdf to one of the cells ?

Chance,

F, G + HH
 
Would that display the entire contents of the pdf in cell? Currently the users just insert the file as an icon.
 
only as a icon, to display the contents you would need to look into somethign like adobe distiller

Chance,

F, G + HH
 
I'll see what I can do with the table approach. I only want an icon, so that's good.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top