+ Reply to Thread
Results 1 to 3 of 3

Maximizing Userforms to suit any screen size

  1. #1

    Maximizing Userforms to suit any screen size

    Hi all,

    I was wondering if it is possible to get a userform to maximize itself
    automatically (to fill the entire screen) when it is activated.

    Currently I set my userforms properties width to be 417.75 and height
    to be 600 - which is fine for some screens but not for others. It would
    be better if I include some code that could determine the users screen
    resolution - and then maximize the userform automatically to fill the
    entire screen of any end-user, no matter what the size or the
    resolution setting.

    Thanks for any help with this

    Regards
    Karen


  2. #2
    Jim Cone
    Guest

    Re: Maximizing Userforms to suit any screen size

    Karen
    If you adjust the lngSize values then this could be close to what you want.
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware


    '---------------------------------------------
    'Insert these three lines at top of module.
    Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
    Const SM_CXSCREEN = 0
    Const SM_CYSCREEN = 1

    '--------------------------------------------
    Public Function GetSR() As String
    GetSR = CStr(GetSystemMetrics(SM_CXSCREEN)) & " x " & _
    CStr(GetSystemMetrics(SM_CYSCREEN))
    End Function
    '-------------------------------------------

    Sub ResizeForm()
    ' Jim Cone - San Francisco, USA
    Dim lngSize As Long
    Dim strSR As String
    Dim lngMax As Long

    strSR = GetSR
    lngMax = Val(strSR)

    If lngMax > 1200 Then
    lngSize = 100
    ElseIf lngMax > 1000 Then
    lngSize = 80
    ElseIf lngMax > 799 Then
    lngSize = 70
    Else
    lngSize = 50
    End If

    UserForm1.Zoom = lngSize
    UserForm1.Width = UserForm1.Width * (lngSize / 100)
    UserForm1.Height = UserForm1.Height * (lngSize / 100)
    UserForm1.Show
    Unload UserForm1
    Set UserForm1 = Nothing
    End Sub
    '-------------------------------------------


    <[email protected]> wrote in message...
    Hi all,
    I was wondering if it is possible to get a userform to maximize itself
    automatically (to fill the entire screen) when it is activated.
    Currently I set my userforms properties width to be 417.75 and height
    to be 600 - which is fine for some screens but not for others. It would
    be better if I include some code that could determine the users screen
    resolution - and then maximize the userform automatically to fill the
    entire screen of any end-user, no matter what the size or the
    resolution setting.
    Thanks for any help with this
    Regards
    Karen

  3. #3

    Re: Maximizing Userforms to suit any screen size

    Thanks Jim - that works well.

    Regards
    Karen


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1