If you use a type library, the Application object should be the object that has the appobject attribute. Because some ActiveX clients use the type information to allow unqualified access to the Application object's members, it is important to avoid overloading the Application object with too many members.
The Application object should have the properties listed in the following table. The Application, FullName, Name, Parent, and Visible properties are required; other properties are optional.
Property name | Return type | Description |
---|---|---|
ActiveDocument | VT_DISPATCH, VT_EMPTY | Returns the active document object or VT_EMPTY if none; read only. |
Application | VT_DISPATCH | Returns the Application object; read only. Required. |
Caption | VT_BSTR | Sets or returns the title of the application window; read/write. Setting the Caption to VT_EMPTY returns control to the application. |
DefaultFilePath | VT_BSTR | Sets or returns the default path specification used by the application for opening files; read/write. |
Documents | VT_DISPATCH | Returns a collection object for the open documents; read only. |
FullName | VT_BSTR | Returns the file specification for the application, including path; read only. For example, C:\Drawdir\Scribble. Required. |
Height | VT_R4 | Sets or returns the distance between the top and bottom edge of the main application window; read/write. |
Interactive | VT_BOOL | Sets or returns True if the application accepts actions from the user, otherwise False; read/write. |
Left | VT_R4 | Sets or returns the distance between the left edge of the physical screen and the main application window; read/write. |
Name | VT_BSTR | Returns the name of the application, such as "Microsoft Excel"; read only. The Name property is the default member (DISPID_VALUE) for the Application object. Required. |
Parent | VT_DISPATCH | Returns the Application object; read only. Required. |
Path | VT_BSTR | Returns the path specification for the application's executable file; read only. For example, C:\Drawdir if the .exe file is C:\Drawdir\Scribble.exe. |
StatusBar | VT_BSTR | Sets or returns the text displayed in the status bar; read/write. |
Top | VT_R4 | Sets or returns the distance between the top edge of the physical screen and main application window; read/write. |
Visible | VT_BOOL | Sets or returns whether the application is visible to the user; read/write. The default is False when the application is started with the /Automation command-line switch. Required. |
Width | VT_R4 | Sets or returns the distance between the left and right edges of the main application window; read/write. |
The Application object should have the following methods. The Quit method is required; other methods are optional.
Method name | Return type | Description |
---|---|---|
Help | VT_EMPTY | Displays online Help. May take three optional arguments: helpfile (VT_BSTR), helpcontextID (VT_I4), and helpstring (VT_BSTR). The helpfile argument specifies the Help file to display; if omitted, the main Help file for the application is displayed. The helpcontextID and helpstring arguments specify a Help context to display; only one of them can be supplied. If both are omitted, the default Help topic is displayed. |
Quit | VT_EMPTY | Exits the application and closes all open documents. Required. |
Repeat | VT_EMPTY | Repeats the previous action in the user interface. |
Undo | VT_EMPTY | Reverses the previous action in the user interface. |