# Exporting word count to Excel



## lynnnow (Jan 12, 2005)

Hi,

Is there a way to export the word count of the active document to Excel.  I've got the macro to get the word count and page count.  however, i'm not sure what to use in order to get the data out of Word and into Excel.

I'm stumped with this part.

Any help will be appreciated.

ray:


----------



## philR (Jan 25, 2005)

One way would be to save the number into a text file in Word, and pick it up in Excel.  You could do this like this:

In Word


```
Open "c:\tempdata.txt" For Output As #1
   Write #1, wordcount, pagecount
Close #1
```

In Excel:


```
Open "c:\tempdata.txt" For Input As #1
   Input #1, wordcount, pagecount
Close #1
```

This method has some advantages as it doesn't rely on checking if the spreadsheet is already open, and can be used to pass data between any applications that can write text files.


----------

