Linked Documents in Word

C

Chris

Hey,
I want to programatically add a linked (xls) document to my word document.

I have 2 questions,
- what are the method calls to do this in vba.

I can use a http://bleh.xls reference in 2003, this does not seem to work in
2k. is there another
way of getting the file from http in office 2k?

Thanks for your time/help
Chris
 
C

Cindy M -WordMVP-

Hi Chris,
I want to programatically add a linked (xls) document to my word document.

I have 2 questions,
- what are the method calls to do this in vba.

I can use a http://bleh.xls reference in 2003, this does not seem to work in
2k. is there another
way of getting the file from http in office 2k?
There are two basic ways to insert/link Excel data into Word. One is with
Word's spreadsheet converter (equivalent of Insert/File command). The other is
using OLE (equivalent of Paste Special with a link or Insert/Object). You
might see if Insert/File will support the http-type path.

In any case, both types of link are maintained by a FIELD. My preference, when
inserting a link to an outside object, is to create the field rather than
trying to get the command equivalents for Insert/File or Insert/Object to work
correctly via VBA. So my advice:
- test the two methods mentioned above to find the one best suited to what
you need

- Press Alt+F9 to see the field code it generates

- Take what you find between the field brackets { } and use it in the TEXT
argument of the Fields.Add method. Roughly, you'd have
doc.fields.Add Range:=rng, Type:=wdFieldEmpty, Text:=sFieldCode,
PreserveFormatting:=False

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top