title: automate word for windows 2007 from javascript
body: <p>I have a Web application which invokes Word for Windows in order to perform spell checking on text taken from a Web form.  The code uses the ActiveXObject call to create an instance of Word and makes use of the "HTMLProject" property to create a document and add text to it.  The code works great with Windows 2003, but crashes with 2007 because Word 2007 apparently doesn't support the HTMLProject property any more.  Following is the old code; my question is, what is the simplest possible way to make this code work for Word 2007?</p>
  
  <pre><code>function spellCheck(textToCheck) { 
      wordApplication = new ActiveXObject("word.application"); 
      wordDocument = wordApplication.Documents.Add("", false, wdNewWebPage)      
      wordApplication.ActiveDocument.HTMLProject.HTMLProjectItems(1).Text = textToCheck
      wordApplication.ActiveDocument.HTMLProject.RefreshDocument(true) 
      wordApplication.ActiveDocument.SpellingChecked = false wordApplication.Visible = true; 
      wordApplication.Activate(); wordApplication.ActiveDocument.Activate(); 
      wordApplication.ActiveDocument.CheckSpelling(); 
  }
  </code></pre>