View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Brian Brian is offline
external usenet poster
 
Posts: 683
Default How do you resize a Multi Page User Form?

Have you ever seen the code on Chip Pearsons site for doing this? It has
provisions for Min/Max/Resizing Control etc... My problem is that the code
is very intimadating to me because I don't know enough about it. I am sure it
works well, but I wouldn't have a clue how to even set it up let alone
trouble shoot it.

http://www.cpearson.com/excel/formcontrol.aspx



"OssieMac" wrote:

Hi Brian,

Changing the userform size does not appear to change the size of the
controls within the userform. You need to use Zoom for that. The following
code tests for the video resolution and sets the useform Height, Width and
Zoom accordingly. However, some caveats. Video resolution Height and Width is
not proportional for all resolutions so there is some discreprencies in the
calculations, particulary with the Zoom, but it depends to some extent how
large you want the userform in relation to the usable screen size so you will
need to do some testing.

Note the comments. The API declaration must be at the top of the module
before any other subs. You will need to set the values depending on the
resolution of the screen on which the userform was developed.

'Video display code from the following link
'http://spreadsheetpage.com/index.php/site/tip/determining_the_users_video_resolution/

'API declaration (At top of module)
Declare Function GetSystemMetrics32 _
Lib "user32" _
Alias "GetSystemMetrics" _
(ByVal nIndex As Long) As Long

Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1


Sub Show_Userform()
Dim vidWidth As Long
Dim vidHeight As Long
Dim dblMultWdth As Double
Dim dblMultHt As Double
Dim dblZoom As Double

vidWidth = GetSystemMetrics32(SM_CXSCREEN)
vidHeight = GetSystemMetrics32(SM_CYSCREEN)

'1152 and 864 is initial setup resolution
'Edit to your setup screen resolution
dblMultWdth = vidWidth / 1152
dblMultHt = vidHeight / 864

dblZoom = (dblMultWdth + _
dblMultHt) / 2 'Average

With UserForm1
'Lookup in Help for other options
'for StartUpPosition. Needs to be manual
'for setting left and top positions.
.StartUpPosition = 0
.Zoom = 100 * dblZoom
.Width = .Width * dblMultWdth
.Height = .Height * dblMultHt
.Top = 200
.Left = 100
.Show
End With

End Sub


--
Regards,

OssieMac