See Also Example
Moves a form or control.
Syntax
[object.]Move left[, top[, width[, height] ] ]
Remarks
The Move method has these parts:
Part Description
object Form or control to move. May be any control except timers and menus.
left Single-precision value indicating the horizontal coordinate for the left edge of object.
top Single-precision value indicating the vertical coordinate for the top edge of object.
width Single-precision value indicating the new width of object.
height Single-precision value indicating the new height of object.
Only the left argument is required. However, to specify any other arguments, you must specify all arguments that appear in the syntax before the argument you want to specify. For example, you cannot specify width without specifying left and top. Any trailing arguments that are unspecified remain unchanged.
For forms and for controls within frames, the coordinate system is always twips Moving a form on the screen or moving a control within a frame is always relative to the origin (0,0), which is the upper-left corner. When moving controls on a form or in a picture control, the coordinate system of the object is used. The coordinate system is set using ScaleHeight, ScaleWidth, ScaleLeft and ScaleRight properties.
Height Property
Left Property
ScaleHeight Property
ScaleLeft Property
ScaleMode Property
ScaleWidth Property
Top Property
Width Property
The example uses the Move method to move a form around on the screen. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim In, Msg ' Declare variables.
Msg = "Choose OK to resize and move this form by "
Msg = Msg & "changing the value of properties."
MsgBox Msg ' Display message.
In = 1440 ' Set inch in twips.
Width = 4 * In ' Set width.
Height = 2 * In ' Set height.
Left = 0 ' Set left to origin.
Top = 0 ' Set top to origin.
Msg = "Now choose OK to resize and move this form "
Msg = Msg & "using the Move Method."
MsgBox Msg ' Display message.
Move Screen.Width - 2 * In, Screen.Height - In, 2 * In, In
End Sub