Make your own free website on

Set Form Location And Size At Run-Time

'Add 1 Command Button to your form.
'Insert the following code to your form:

Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, _
ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight _
As Long, ByVal bRepaint As Long) As Long

Private Sub Command1_Click()
'Replace '250, 250, 400, 400' with the form coordinates.
Call MoveWindow(Me.hwnd, 250, 250, 400, 400, 1)
End Sub

Go Back