Thread: Excel - word
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E AA2e72E is offline
external usenet poster
 
Posts: 400
Default Excel - word

The format for importing data into Excel that has the least dependency on
other things is the CSV format. So, unless your source users are given Excel,
see if it possible for them to use NOTEPAD, available on all PCs. If you do
not know anything about CSV, look it up in the Excel help files.

If you have to use Word ...

-Word does not have data types; everything is text.
-In Excel you have workbooks, worksheets, ranges, cells etc; in word you
have documents, paragraphs, sentences, words, tables, bookmarks etc.
-If you like, research DDE; this may work but is tenuous.

Experiment with this:

Open one of the word documents--no other Word sessions exist. I'll assume
that the data you want to import are in tables.

Set WD=GetObject(,"Word.Application")
WD.ActiveDocument.Tables(1).Select

Rows=Selection.Rows.Count
Cols = Selection.Columns.Count

You now have the dimensions of the data in table 1. In orderto get the text,

data = wd.selection.text

As I mentioned, all data in Word is text.

The content of the table, data, contains the contents of the table; reformat
it and use array techniques to send the data to excel.