This code from Jim Cone worked for me...
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Sub ResizeForm_R1()
' Adjusts userform size to compensate for screen resolution changes.
' Calls function GetSR
' Jim Cone - San Francisco, USA - Dec 2006
Dim varSize As Variant
Dim RatioX As Single
Dim RatioY As Single
Dim ActualX As Long
Dim ActualY As Long
'Screen resolution in development environment.
'Adjust as necessary <<<
Const BaseX As Long = 800
Const BaseY As Long = 600
'Call function to get actual screen resolution
varSize = GetSR
ActualX = varSize(0)
ActualY = varSize(1)
'Determine ratio of actual screen resolution to
'the original or base resolution.
RatioX = ActualX / BaseX
RatioY = ActualY / BaseY
'Adjust userform magnification and size.
UserForm1.Zoom = (100 * ((RatioX + RatioY) / 2))
UserForm1.Width = UserForm1.Width * RatioX
UserForm1.Height = UserForm1.Height * RatioY
UserForm1.Show
Unload UserForm1
Set UserForm1 = Nothing
End Sub
'---------------------------------
Public Function GetSR() As Variant
' x and y
GetSR = Array(GetSystemMetrics(0), GetSystemMetrics(1))
End Function
thanks for ur reply..
after finding out the resolution of the monitor,what do i do?
how do i size my form accordingly?i mean what size should i hav for one resolution and what for some other resolution?
how do i proceed??
an example would help..