Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default size of user form

Is there a way of getting a user form in excel to adjust in size to fi
an individuals screen. I have a form that shows up completly on a 17
screen but gets cutoff on a 15" scree

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default size of user form

As far as I know, you'll need to use the Windows API function
GetSystemMetrics32 to get the screen resolution. Also, the units used by
UserForm.Move don't seem to be on the same scale as screen resolution - you
have to multiply resolution by 3/4.

GetSystemMetrics32 declaration and sample code for setting the size of your
form are below. Note that this form will cover up your taskbar. You can
reduce the height a bit to account for that, but that will assume that the
user's task bar is on the bottom of the screen. To truly account for the
taskbar, regardless of its position, there is a separate API function called
SystemParametersInfo that you'd need to use. This would be more complicated!


Declare Function GetSystemMetrics32 Lib "User32" _
Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long

Sub ShowMaximizedForm()
Dim screenw As Long, screenh As Long
screenw = GetSystemMetrics32(0) ' screenwidth in points
screenh = GetSystemMetrics32(1) ' screenheight in points

UserForm1.Move 0, 0, screenw * .75, screenh * .75
UserForm1.Show

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
User Form Joanne Excel Discussion (Misc queries) 1 June 26th 07 02:26 PM
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
User form David Excel Programming 0 April 22nd 04 09:21 PM
I am looking to see if anybody has an equivalant user form to Outlooks CONTACT form BruceJ[_2_] Excel Programming 2 October 15th 03 05:28 PM
User Form SP Excel Programming 2 July 21st 03 11:34 PM


All times are GMT +1. The time now is 04:14 PM.

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"