I've been running this VBSCRIPT code from within HTML to open & manipulate MSWord 2003 doc, but when MSOffice got updated to 2007, i can't make it to work in MSWord 2007. It only open a blank Word document. Not even opening the existing file. Can someone please help?
Code:
'Open existing Word Doc
Const wdReplaceAll = 2
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Open("test.Doc")
Set objSelection = objWord.Selection
'Find & Replace text within word Doc
objSelection.Find.Text = "OLD-TEXT"
objSelection.Find.Forward = TRUE
objSelection.Find.MatchWholeWord = TRUE
objSelection.Find.Replacement.Text = "NEW-TEXT
objSelection.Find.Execute ,,,,,,,,,,wdReplaceAll
objDoc.Display