InsideHeight, InsideWidth properties example

The following example uses the InsideHeight and InsideWidth properties to resize a CommandButton. The user clicks the CommandButton to resize it.

Note

InsideHeight and InsideWidth are read-only properties.

To use this example, copy this sample code to the Declarations portion of a form. Make sure that the form contains:

  • A CommandButton named CommandButton1.
Dim Resize As Single 
 
Private Sub UserForm_Initialize() 
 Resize = 0.75 
 CommandButton1.Caption = "Resize Button" 
 
End Sub 
 
Private Sub CommandButton1_Click() 
 CommandButton1.Move 10, 10, _ 
 UserForm1.InsideWidth * Resize, _ 
 UserForm1.InsideHeight * Resize 
 CommandButton1.Caption = "Button resized " _ 
 & "using InsideHeight and InsideWidth!" 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.