Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automating Word for spell checking
Message
From
30/10/2004 16:19:13
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Automating Word for spell checking
Miscellaneous
Thread ID:
00956177
Message ID:
00956177
Views:
55
I need to send a text to Word for spell checking. However, there is no interaction. I need to have all this invisible in the background and I need to get back the list of words which have errors.

The following code is not complete. I need to go thru the collection of errors and get the text. If someme can let me know how to complete that, it would be appreciated.
* Create a Word document object
loWord=CreateObject('Word.Application')
loDocument=loWord.Documents.Add
loWord.Visible=.T.

* Position Word off screen to avoid having document visible
loWord.WindowState=0
loWord.Top=-3000

* Assign the text to the document and check spelling
loDocument.Content.Text='The long bridge faiiled in the middle.'
loDocument.Activate

lnCount=loDocument.SpellingErrors.Count
IF lnCount>0
   loErrors=loDocument.SpellingErrors
   FOR EACH loError IN loErrors
       MESSAGEBOX(loError.Text)
   ENDFOR
ENDIF

* Close the document and exit Word...
loDocument.Close(0)

loWord.Quit
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform