Stopping a form from maximizing on load

Shaft

Registered User.
Local time
Today, 03:59
Joined
May 25, 2005
Messages
51
Is there a piece of code I can use to stop a form maximizing on load, so it stays the orignal designed size?
 
You dont need code, just don't let the user ever maximize it.

Go into design view.
Make sure auto-resize is on.
Take away the min/max buttons.
Change the border style to thin.
 
I prefer to customize and force the size of my forms with the InsideHeight & InsideWidth properties using the forms OnOpen event. I set my forms property to PopUp to NO and Modal to YES and I set the forms Control Box to NO and the Min MAx buttons to NONE and the Close button to NO.

Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
    
    'just for testing
    MsgBox "InsideHeight = " & InsideHeight & vbCrLf & vbLf & "InsideWidth = " & InsideWidth
    
    InsideHeight = 5450 'twips is the unit of measurement
    InsideWidth = 7870
    
Exit_Form_Open:
    Exit Sub
    
Err_Form_Open:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_Form_Open
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom