Summary

This chapter highlighted some of the more useful properties and methods of the Application object. Because Application is used to hold general-purpose functionality that does not fall clearly under other objects, it is easy to miss some of these very useful capabilities.

The following properties and methods were covered:

□ ActiveCell: Contains a reference to the active cell.

□ ActiveChart: Contains a reference to the active chart.

□ ActivePrinter: Contains a reference to the active printer.

□ ActiveSheet: Contains a reference to the active worksheet.

□ ActiveWindow: Contains a reference to the active window.

□ ActiveWorkbook: Contains a reference to the active workbook.

□ Caller: Contains reference to the object that called a macro.

□ DisplayAlerts: Determines whether or not alert dialogs are displayed.

□ Evaluate: Used to calculate Excel functions and generate Range objects.

□ InputBox: Used to prompt a user for input.

□ OnKey: Assigns a macro to a single keystroke, or a combination (with Ctrl, Alt, and so on).

□ OnTime: Used to set the time for a macro to run.

□ ScreenUpdating: Determines whether screen updating is turned on or off.

□ Selection: Contains a reference to the selected range.

□ SendKeys: Sends keystrokes to the active window.

□ StatusBar: Allows messages to be displayed on the status bar.

□ WorksheetFunction: Contains the Excel functions available to VBA.

This is but a small sample of the total number of properties and methods of the Application object— there are more than 200 of them in Excel 2007. A full list is given in Appendix A.

0 0

Post a comment