We help IT Professionals succeed at work.

# Screen Resolution Problem on Userforms

on
733 Views
I have a huge form. The dimensions are:
Height: 787.5
Width: 1000

I produced on a 1680x1050 computer. When I tried it on other computers, the form didnt look as nice .
So I found the code below.

So I use scrollbars and zoom to overcome this problem.

1. My first question is how can I make this screen resolution code more flexible so it works on any type of screen resolution and looks nic.
2. Is there an easier and more efficient way to overcome the resolution problem.
``````With Application
.WindowState = xlMaximized
If x > 0 And y > 0 Then
'1680-1050
If x = 1680 And y = 1050 Then
Me.Zoom = Int(.Height / Me.Height * 120)
Me.Width = .Width * 1#
Me.Height = .Height
'MsgBox x & " " & y

Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 1.3
Me.ScrollWidth = Me.InsideWidth * 1.3
End If

'1280 - 1024
If x = 1280 And y = 1024 Then
Zoom = Int(.Height / Me.Height * 140)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2
End If

If x = 1280 And y = 960 Then
Zoom = Int(.Height / Me.Height * 160)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2

End If

If x = 1280 And y = 768 Then
Zoom = Int(.Height / Me.Height * 140)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2

End If
If x = 1152 And y = 864 Then
Zoom = Int(.Height / Me.Height * 160)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 1.6
Me.ScrollWidth = Me.InsideWidth * 1.6

End If
If x = 1024 And y = 768 Then
Zoom = Int(.Height / Me.Height * 180)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 1.8
Me.ScrollWidth = Me.InsideWidth * 1.8

End If
If x = 800 And y = 600 Then
Zoom = Int(.Height / Me.Height * 200)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2

End If

Else
Zoom = Int(.Height / Me.Height * 200)
Me.Width = .Width * 1#
Me.Height = .Height
Me.ScrollBars = fmScrollBarsBoth
Me.ScrollHeight = Me.InsideHeight * 2
Me.ScrollWidth = Me.InsideWidth * 2

End If
End With
``````
Comment
Watch Question
Commented:
This problem has been solved!
###### Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

Deciding to stick with EE.

Mohamed Asif

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant