Working with the Application Window

The application's window contains the interface elements such as the Ribbon and the status bar, as well as an area for displaying a document. In Word, PowerPoint, and Access the application window can have multiple instances (one for each open document, presentation, or database), whereas in Excel there is always just one application window (possibly with multiple open workbooks). You can wield seven Application object properties to control the application window:

■ Application.Height—Returns or sets the height, in points, of the application window.

■ Application.Left—Returns or sets the distance, in points, of the left edge of the application window from the left edge of the screen.

■ Application.Top—Returns or sets the distance, in points, of the top of the application window from the top of the screen.

■ Application.UsableHeight—The maximum height, in points, that a window can occupy within the application's window. In other words, this is the height of the application window less the vertical space taken up by the title bar, menu bar, toolbars, status bar, and so on.

■ Application.UsableWidth—The maximum width, in points, that a window can occupy within the application's window. This is the width of the application window less the horizontal space taken up by items such as the vertical scroll bar.

■ Application.Width—Returns or sets the width, in points, of the application window.

■ Application.WindowState—Returns or sets the state of the main application window. This property is controlled via three built-in constants that vary between applications:

Window State

Excel

Word

PowerPoint

Maximized Minimized Normal xlMaximized xlMinimized xlNormal wdWindowStateMaximize wdWindowStateMinimize wdWindowStateNormal ppWindowMaximized ppWindowMinimized ppWindowNormal

0 0

Post a comment