Managing the Excel Application

In the beginning of this chapter, you learned that objects are organized in a special structure called the object model. The topmost object in an application's object model is the application itself. By controlling the Application object, you can perform many tasks, such as saving the way your screen looks at the end of a day's work or quitting the application. As you know, Excel allows you to save the screen settings by using the Save Workspace option from the File menu. The task of saving the workspace can be easily performed with VBA:

Application.SaveWorkspace "Project"

The above instruction saves the screen settings in the workspace file named "Project." The next time you need to work with the same files and arrangement of windows, simply open the Project file and Excel will bring up the correct files and restore your screen to your liking.

To render this into VBA:

Enter this in the Immediate window:

Check the name of the active application.

Change the title of the Excel application to "My Application."

Change the title of the Excel application back to "Microsoft Excel."

Find out what operating system you are using.

Find out the name of the person or firm to whom the application is registered.

Find out the name of the folder where Excel.exe resides.

Quit working with Microsoft Excel.

?Application.Name

Application.Caption = "My Application"

Application.Caption = "Microsoft Excel"

?Application.OperatingSystem ?Application.OrganizationName ?Application.Path Application.Quit

0 0

Post a comment