LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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

 
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
sizing a chart Jordan Charts and Charting in Excel 1 February 13th 07 07:30 PM
Userform / Text Box problems. PW11111 Excel Discussion (Misc queries) 1 December 20th 06 12:02 PM
Problems Auto Sizing in Excel DAldridge Excel Discussion (Misc queries) 1 October 10th 06 12:55 AM
Name Box sizing KenInPortland Excel Discussion (Misc queries) 1 December 21st 05 08:15 PM
Row Sizing Mike@ACM Excel Discussion (Misc queries) 2 July 16th 05 04:04 AM


All times are GMT +1. The time now is 07:18 PM.

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

About Us

"It's about Microsoft Excel"