Private Sub UserForm_Initialize()
Dim vSize As Variant
vSize = ScreenResolution
Me.Width = vSize(1) - 10
Me.Height = vSize(2) - 10
End Sub
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, _
ByVal nIndex As Long) As Long
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, _
ByVal hdc As Long) As Long
Const HORZRES = 8
Const VERTRES = 10
Function ScreenResolution()
Dim lRval As Long
Dim lDc As Long
Dim arr(1 To 2) As Long
lDc = GetDC(0&)
arr(1) = GetDeviceCaps(lDc, HORZRES)
arr(2) = GetDeviceCaps(lDc, VERTRES)
lRval = ReleaseDC(0, lDc)
ScreenResolution = arr
End Function