Поделиться через


Working with the 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.

Every time you write VBA code in Word, or write code to automate Word from some other application, you begin with the Application object. From the Application object, you can access all the other objects exposed by the application as well as properties and methods unique to the Application object itself.

**Note   **If you are working in Word, the Application object is created for you, and you can use the Application property to return a reference to the Word Application object. If you are automating Word from some other application, you must create a Word Application object variable and then create an instance of Word.

To access properties and methods of the Application object, you use the following syntax:

Application.PropertyNameApplication.MethodName(arg1,arg2,argN)

You can access child objects of the Application object by using the following syntax:

Application.ObjectName

–or–

ObjectName

**Note   **You do not have to use the Application property in this context because these objects are global.

See Also

Working with Microsoft Word Objects | Understanding Application-Level Objects | Working with the Settings in the Options Dialog Box | Working with Word Dialog Boxes | Modifying Built-in Commands | The Document Object