Partager via


How to: Move Controls on a Page

The following example demonstrates moving all the controls on a form by using the Move method with the Microsoft Forms 2.0 Controls collection. The user clicks on the CommandButton to move the controls.

To use this example, copy this sample code to the Script Editor of a form. Make sure that the form contains a CommandButton named CommandButton1 and several other controls.

Sub CommandButton1_Click() 
 Set Controls = Item.GetInspector.ModifiedFormPages("P.2").Controls 
 'Move each control on the form right 25 points and up 25 points. 
 Controls.Move 25, -25 
End Sub