Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Sizing a UserForm

Paul,

I used this on a form that actually takes up the whole screen. You'd have
to tinker with the ratios to have it almost fill the screen. It works
fairly well, although the fonts might not look quite right:

Sub size_form_and_controls()

Dim start_height As Long, start_width As Long, new_height As Long, new_width
As Long
Dim height_ratio As Double, width_ratio As Double
Dim ctl As Control

With UserForm
start_height = 768 'default settings on your computer
start_width = 1024
new_height = Application.Height 'find current screen resolution
new_width = Application.Width
height_ratio = new_height / start_height 'ratio to apply to form and all
controls
width_ratio = new_width / start_width
.Height = new_height 'resize the whole form
.Width = new_width
For Each ctl In .Controls 'resize the controls and text
ctl.Top = ctl.Top * height_ratio
ctl.Left = ctl.Left * width_ratio
ctl.Height = ctl.Height * height_ratio
ctl.Width = ctl.Width * width_ratio
On Error Resume Next 'if control has no font then skip
ctl.Font.Size = ctl.Font.Size * height_ratio
On Error GoTo 0
Next ctl
End With

End Sub

hth,

Doug Glancy

"darryl26" wrote in message
...
Is there a way to have a userform sized to fit the user's screen?

My display is set at 1024x768 and the form takes up most of the screen,

but
I have some users whose display is 800x600 (for vision purposes) and they

can
only see half the form when they run the program.

I tried altering the Zoom property on the Userform but it cut off the text
on some of the controls on the userform and I'm hoping that there's a way

to
adjust everything at once.

Thanks!
Paul




  #2   Report Post  
Posted to microsoft.public.excel.programming
HFB HFB is offline
external usenet poster
 
Posts: 17
Default Sizing a UserForm

Would doing this mean that if the form were printed, it would fill the
printed page also? I'm trying to make my form fill an A4 (portrait) page.
I've used the sizing controls to make the form as big as it will let me, but
there's still about two inches of blank space on the page when I print.

"Doug Glancy" wrote:

Paul,

I used this on a form that actually takes up the whole screen. You'd have
to tinker with the ratios to have it almost fill the screen. It works
fairly well, although the fonts might not look quite right:

Sub size_form_and_controls()

Dim start_height As Long, start_width As Long, new_height As Long, new_width
As Long
Dim height_ratio As Double, width_ratio As Double
Dim ctl As Control

With UserForm
start_height = 768 'default settings on your computer
start_width = 1024
new_height = Application.Height 'find current screen resolution
new_width = Application.Width
height_ratio = new_height / start_height 'ratio to apply to form and all
controls
width_ratio = new_width / start_width
.Height = new_height 'resize the whole form
.Width = new_width
For Each ctl In .Controls 'resize the controls and text
ctl.Top = ctl.Top * height_ratio
ctl.Left = ctl.Left * width_ratio
ctl.Height = ctl.Height * height_ratio
ctl.Width = ctl.Width * width_ratio
On Error Resume Next 'if control has no font then skip
ctl.Font.Size = ctl.Font.Size * height_ratio
On Error GoTo 0
Next ctl
End With

End Sub

hth,

Doug Glancy

"darryl26" wrote in message
...
Is there a way to have a userform sized to fit the user's screen?

My display is set at 1024x768 and the form takes up most of the screen,

but
I have some users whose display is 800x600 (for vision purposes) and they

can
only see half the form when they run the program.

I tried altering the Zoom property on the Userform but it cut off the text
on some of the controls on the userform and I'm hoping that there's a way

to
adjust everything at once.

Thanks!
Paul





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
Column sizing CJ Charts and Charting in Excel 3 March 12th 09 04:56 PM
Userform sizing problems Oggy Excel Discussion (Misc queries) 1 March 12th 07 09:27 PM
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
Sizing a UserForm Jim Rech Excel Programming 1 August 11th 04 07:39 PM


All times are GMT +1. The time now is 05:24 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"