Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform sizing problems Oggy Excel Discussion (Misc queries) 1 March 12th 07 09:27 PM
Problems Auto Sizing in Excel DAldridge Excel Discussion (Misc queries) 1 October 10th 06 12:55 AM
Sizing a UserForm Doug Glancy Excel Programming 1 January 20th 05 02:27 AM
Sizing a UserForm Jim Rech Excel Programming 1 August 11th 04 07:39 PM
More UserForm problems Les[_4_] Excel Programming 2 July 23rd 03 12:29 AM


All times are GMT +1. The time now is 02:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"