View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Updating a word count from a wrod file into excel


Sub Test()

'
FName = "c:\temp\abc.doc"
WordWasRunning = True

On Error Resume Next
Set WDApp = GetObject(, "Word.Application")
If Err.Number < 0 Then
Set WDApp = CreateObject("Word.Application")
WordWasRunning = False
End If

WDApp.Visible = True 'at least for testing!

Set WDDoc = WDApp.documents.Open(Filename:=FName)
Count = WDDoc.Words.Count
Range("A1") = Count

WDDoc.Close

End Sub

"Laebrye" wrote:

Hi everyone,

My VBA knowledge isn't the best, so this may not even be possible. I've
looked through the functions and the data link options and not found anything
that will work - so far.

I'm hoping that someone can give me a rough idea of the sort of code I would
need to update the word count from a word document into a cell in excel.

Dave