Hi everyone
Sorry for the delay:

'This is a function which I wrote for displaying and adjusting the form size
for my project:


Public Sub mZoom(ByRef Form As Object, Optional Hzoom As Integer, Optional
Vzoom As Integer)
If Vzoom = 0 Or Hzoom = 0 Then
Hzoom = Application.Width / Form.Width * 100
Vzoom = Application.Height / Form.Height * 100
End If

Dim MinZoom
If Hzoom > Vzoom Then
MinZoom = Vzoom
Else
MinZoom = Hzoom
End If

For Each c In Form.Controls
If Hzoom > 100 Then
c.Width = c.Width * Hzoom / 100
c.Left = c.Left * Hzoom / 100
Else
c.Width = c.Width * Hzoom / (200 - Hzoom)
c.Left = c.Left * Hzoom / (200 - Hzoom)
End If
If Hzoom > 100 Then
c.Height = c.Height * Vzoom / 100
c.Top = c.Top * Vzoom / 100
Else
c.Height = c.Height * Vzoom / (200 - Vzoom)
c.Top = c.Top * Vzoom / (200 - Vzoom)
End If
On Error Resume Next
c.Font.Size = CInt(c.Font.Size * MinZoom / 100)
Next c
If Hzoom > 100 Then: Form.ScrollWidth = Form.Width * Hzoom / 100
If Vzoom > 100 Then: Form.ScrollHeight = Form.Height * Vzoom / 100
Form.Width = Form.Width * Hzoom / 100
Form.Height = Form.Height * Vzoom / 100
Form.Show
End Sub

If you have missed to read the original post, I had told that I will post
some code for

1) adjusting the form size according to the screen size

2) distributing the controls and adjusting their font size and

3) determining and adjusting the scroll height/width of the form

If you ommit to specify the optional variables, it will maximise the excel
window and use the dimensions of its parent aplication. Otherwise, you may
also specify the percentage of how much you want to strech/shrink the
userform.

eg: call mzoom(userform1, 120,120)

or just

call mzoom(userform1)



Thanking you :)


Hemant Hegde

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe

Reply via email to