4umi.com/web/javascript/spellcheck

Check that spell

Basic Javascript

A spell check app in Javascript. Right.

The idea

To select and copy the target text, open Word, paste it in a new document, run Word's built-in spell checker, and replace the selection with the changes it makes.

The script

The main Javascript function looks like this:

function spellcheck() {
 var newstr, nRet, oShell, oWord;
 oShell = new ActiveXObject( 'WScript.Shell' );
 window.focus();
 oShell.SendKeys( "^a" );  //  select all
 oShell.SendKeys( "^c" );  //  copy
 oWord = new ActiveXObject( 'Word.Application' );
 oWord.Visible = true;
 oWord.Documents.Add();
 oWord.Selection.Paste();
 oWord.ActiveDocument.CheckSpelling();
 oWord.Selection.WholeStory();
 //newstr = oWord.Selection.Text; window.alert( newstr );
 oWord.Selection.Copy();
 oWord.ActiveDocument.Close( 0 );
 oWord.Quit();
 nRet = oShell.Popup( 'Replace the selection with the text checked by Word?',
  0, 'Spell check complete', 36 );
 if ( nRet == 1 ) {
  oShell.SendKeys( "^v" );  //  paste
 }
 return false;  //  to the <a href>
}

Try it by clicking this link: check the spelling! And let see who will be first to spot the deliberate error in this page, you or the aplication?

There is more that can be done. You'll want to reference the VBA documentation for Word. Do a search on your hard drive for "VBAWRD9.CHM". If it can't be found, you'll likely need to install the documentation off the Microsoft Office CD.