I've written a simple program in VB, which creates an instance of a Word application, enters some text, and saves the document.
Here is a sample of what I have:
it works fine. But what I want to do now is have this run in VBScript. I know that from VBScript I can create an instance of a Word Application, but when I tried to run this as above, it screamed at me when it tried to compileCode:Set objWord = New Word.Application Set doc1 = objWord.Documents.Open("c:\temp\report.doc") With objWord.Selection .EndKey Unit:=wdStory .Tables.Add Range:=objWord.Selection.Range, NumRows:=1, NumColumns:=5 .TypeText Text:="First Name" .MoveRight Unit:=wdCell .TypeText Text:="Last Name" 'do more editing of the document here End With 'save the file doc1.SaveAs FileName:="c:\temp\report1.doc" doc1.Close objWord.QuitCould someone please indicate why this will not work in VBScript. Or can I even do this in VBScript. Does anyone know of a resource where I can find how to refer to the Word Object Model in VBScript ??Code:.EndKey Unit:=wdStory
tx




Reply With Quote