Inserting spreadsheets in a word document

C

Claude Martel

Does anyone know how to programmatically insert an excel spreadsheet
into a Word document.

I tried InsertFile("MySpreadsheet.xls") and it inserts the binary
content of the document, not the actual spreadsheet.
 
C

Cindy M -WordMVP-

Hi Claude,
Does anyone know how to programmatically insert an excel spreadsheet
into a Word document.
There are basically two approaches for the automation interface. One
is the InsertObject method. Personally, I find this to be a bit
unreliable.

The other, which I prefer, is to generate a LINK field (like Word does
when you use Edit/Paste Special, with "Link" activated; use Alt+F9 to
toggle the field codes on/off) using the Fields.Add method. With the
help of the various switches, I can tell Word whether to display the
table as an Excel object, as a Word table (using either RTF or HTML
conversion), or as unformatted text. If I don't want to retain the
link, I can break it after the field has been inserted and updated.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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