How to Create Word Documents With VBScript


Visual Basic Scripting (VBScript) is a lightweight programming language that provides network administrators with the ability to automate user processes. The scripting language is used for logon scripts, which are run each time a user starts the computer. The VBScript language has the ability to create a Microsoft Word document. This is beneficial for administrators who want to provide a document on the user's desktop.

  • Open a basic text editor. Most system administrators use Microsoft Notepad to create VBScript logon scripts.

  • Initialize the Word application object on the user's machine. The following code initializes the Word application object, which is later used to create the document:
    Set word = CreateObject(”Word.Application”)

  • Add the document. When you open the Word application using VBScript, the object is open but no document is created. The following code creates a document for the container:
    Set document = word.Documents.Add()

  • Add some verbiage to the opened document. The following code illustrates how to add text to your Word document:
    document.TypeText “My first document”

  • Save the document to the hard drive. The following code copies the newly created Word document to the hard drive and closes the Word application:

Related Searches


  • Photo Credit computers network image by Orlando Florin Rosu from
Promoted By Zergnet


You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!