📜  excel vba center userform - VBA代码示例

📅  最后修改于: 2022-03-11 14:51:54.037000             🧑  作者: Mango

代码示例1
' On application window
Private Sub UserForm_Initialize() 
   Me.Top = Application.Top + (Application.UsableHeight / 2) - (Me.Height / 2) 
   Me.Left = Application.Left + (Application.UsableWidth / 2) - (Me.Width / 2) 
End Sub 
' Or
With myForm
    .StartUpPosition = 0    ' Manual
    .StartUpPosition = 1    ' CenterOwner    
    .StartUpPosition = 2    ' CenterScreen
    .StartUpPosition = 3    ' WindowsDefault, screen top left
End With