Application.UsableHeight Property

Project Developer Reference

Returns the maximum height available for a project window in points. Read-only Double.

Syntax

expression.UsableHeight

expression   A variable that represents an Application object.

Return Value
Double

Remarks

The UsableHeight property equals the total amount of vertical space inside the main window minus the space taken up by toolbars, menu bars, status bars, scroll bars, and the title bar.

Example
The following example moves the windows of every open project inside the main window.

Visual Basic for Applications
  Sub FitWindows()
Dim W As Window   ' The Window object used in For Each loop

For Each W In Application.Windows
    ' Adjust the height of each window, if necessary.
    If W.Height &gt; <strong class="bterm">UsableHeight</strong> Then
        W.Height = <strong class="bterm">UsableHeight</strong>
        W.Top = 0
    ' Adjust the vertical position of each window, if necessary.
    ElseIf W.Top + W.Height &gt; <strong class="bterm">UsableHeight</strong> Then
        W.Top = <strong class="bterm">UsableHeight</strong> - W.Height
    End If

    ' Adjust the width of each window, if necessary.
    If W.Width &gt; UsableWidth Then
        W.Width = UsableWidth
        W.Left = 0
    ' Adjust the horizontal position of each window, if necessary.
    ElseIf W.Left + W.Width &gt; UsableWidth Then
        W.Left = UsableWidth - W.Width
    End If
Next W

End Sub

See Also