共用方式為


Application.AppSize 方法 (Project)

設定主視窗的寬度和高度。

語法

expressionAppSize( _Width_, _Height_, _Points_ )

expression 代表 Application 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Width 選用 Long 會指定主視窗新寬度的數字。
Height 選用 Long 會指定主視窗新高度的數字。
Points 選用 Boolean True 是表示 如果 WidthHeight 以點為單位。 為 false ,則它們會以像素為單位。 預設值為 False

傳回值

布林值

範例

下面範例Project主視窗向左移動螢幕的下半部。

Sub MoveMainWindowToLeftHalf() 
 
    Dim WindowHeight As Long 
     
    ' Remember the height when maximized. 
    Application.WindowState = pjMaximized 
    WindowHeight = Application.Height 
     
    AppSize Width:=UsableWidth / 2, Height:=UsableHeight, Points:=True 
    Application.Left = 0 
    ' Be sure the window uses all the available height. 
    If Application.Height < WindowHeight Then Application.Height = WindowHeight 
     
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應