Share via


Application Object

Application Object
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Application
Aa167258.parchild(en-us,office.10).gif

Represents the Microsoft Word application. The Application object includes properties and methods that return top-level objects. For example, the ActiveDocument property returns a Document object.

Using the Application Object

Use the Application property to return the Application object. The following example displays the user name for Word.

  MsgBox Application.UserName

Many of the properties and methods that return the most common user-interface objects — such as the active document (ActiveDocument property) — can be used without the Application object qualifier. For example, instead of writing Application.ActiveDocument.PrintOut, you can write ActiveDocument.PrintOut. Properties and methods that can be used without the Application object qualifier are considered "global." To view the global properties and methods in the Object Browser, click <globals> at the top of the list in the Classes box.

Remarks

To use Automation (formerly OLE Automation) to control Word from another application, use Visual Basic's CreateObject or GetObject function to return a Word Application object. The following Microsoft Excel example starts Word (if it's not already running) and opens an existing document.

  Set wrd = GetObject(, "Word.Application")
wrd.Visible = True
wrd.Documents.Open "C:\My Documents\Temp.doc"
Set wrd = Nothing