Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
|
|||
|
|||
Userform sizing problems
Hi,
I have the following code to set the userform resoultion the the screen on different computers. This works fine on my laptop, but on my home computer it errors on GetSR Can anyone advise me on a code that will work on all PC'S. Many thanks Oggy Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long '--------------------------------- Public Function GetSR() As Variant ' x and y GetSR = Array(GetSystemMetrics(0), GetSystemMetrics(1)) End Function '--------------------------------- Sub menu() ' Adjusts userform size to compensate for screen resolution changes. Dim RatioX As Single Dim RatioY As Single Dim ActualX As Long Dim ActualY As Long 'Screen resolution in development environment. Const BaseX As Long = 1280 Const BaseY As Long = 800 '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. UserForm16.Zoom = (100 * ((RatioX + RatioY) / 2)) UserForm16.Width = UserForm16.Width * RatioX UserForm16.Height = UserForm16.Height * RatioY UserForm16.Show Unload UserForm16 Set UserForm16 = Nothing End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform sizing problems | Excel Discussion (Misc queries) | |||
Problems Auto Sizing in Excel | Excel Discussion (Misc queries) | |||
Sizing a UserForm | Excel Programming | |||
Sizing a UserForm | Excel Programming | |||
More UserForm problems | Excel Programming |