Using MS-Word Spell check API's in VB

Posted on 2004-03-25
Last Modified: 2013-12-26
I have an array of 6 English words. Out of these words some are not spelt properly. While going through this array in a "for loop", I need to write each correctly spelt word into a file (.txt or .doc). If a word is incorrectly spelt then I should not write it in the file.
Should I be using some Word-API to achieve the task? If yes, can you please let me know how to do this? (I have MS Word-2002 installed in my system.)


Now while reading this array only Dollar and Pound should be written out in the file (.txt or .doc).
Question by:subo75

Expert Comment

ID: 10685672
try this tool which i am using:

Accepted Solution

dmenard earned 250 total points
ID: 10686152
Some pseudo code (from my memory) which can help :

' Launch word
Set WordApplication = CreateObject("Word.Application")

' for debugging : let the word window be visible

' Create a new blank document
Set WordDocument = WordApplication.Documents.Add()

' check a word (repeat for each word)
for ...
   WordDocument.Content.Text = h
   if    WordDocument.SpellingErrors.count=0 then
      ' the word is OK
      ' the word is misspelled
   end if

' when all the word are checked, close word
   WordDocument.Close false
   Set WordDocument=nothing

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Paint/Redraw window while dragging 16 83
MsgBox 2 59
Macro Excel - Multiple If conditions 2 81
Collapse and expand table in Word 2010 2 37
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question