Demonstration script that creates a Microsoft Word document, adds some text to the document, and then quits without saving the document. To avoid the "Do you want to save your changes?" dialog box, the script sets the Saved property to TRUE before terminating Word.

Visual Basic
Edit|Remove
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
objSelection.TypeText "ABCDEFGHIJKLM"

objDoc.Saved = TRUE
objWord.Quit