To begin with, you will need the following code:
var w=new ActiveXObject('Word.Application');
if (w != null)
w.Visible = true; //set to false to stop the Word document from opening
obj=w.Documents.Open("C:\\blank.doc"); //this can be any location on your PC, not just C:
docText = obj.Content;
document.write(docText);//Print on webpage
// The above code opens existing document
(Code via codetoad.com)
Using a plain text editor (for instance the Notepad tool that can be found in Windows) you can create the required HTML page by copying the code above and saving the file. Call it test.htm to begin with.
For instance, the line w.Visible = true; can be set to true or false, and determines whether or not the Word document is opened. The default setting is “true".
The line w.Selection.TypeText("Hello world!"); can be altered should you choose – you can enter anything in the double quotes – you might change “Hello world!" to “Hello me!" or any number of alternatives. If you plan to add more text, note you will need to leave a space between the exclamation mark and the quotes (! “) in order for the output to look tidy.
Finally, open Microsoft Word and save a blank file as blank.doc. Once you have done this, close the file.