Making a form 100% of screen height & width

  • Thread starter Thread starter Xool
  • Start date Start date
Hi

Try

Private Sub UserForm_Initialize()
Me.Height = Application.Height
Me.Width = Application.Width
End Sub


OR


Private Sub UserForm_Initialize()
Me.Height = Application.UsableHeight
Me.Width = Application.UsableWidth
End Sub

***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Brilliant, thanks for your speedy reply



Dave Hawley said:
Hi

Try

Private Sub UserForm_Initialize()
Me.Height = Application.Height
Me.Width = Application.Width
End Sub


OR


Private Sub UserForm_Initialize()
Me.Height = Application.UsableHeight
Me.Width = Application.UsableWidth
End Sub

***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Try this in the form mcode module :

' ----------------------------------------------
'- Declaration top of module
Private Declare Function GetSystemMetrics _
Lib "user32" (ByVal nIndex As Long) As Long
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
'------------------------------------------------
'-
Private Sub UserForm_Initialize()
x = GetSystemMetrics(SM_CXSCREEN)
y = GetSystemMetrics(SM_CYSCREEN)
Me.Top = 0
Me.Left = 0
Me.Width = x * 0.75
Me.Height = y * 0.75
End Sub
'------------------------------------------------
 
Back
Top