Edit

Share via


Referencing Controls on an Outlook Form

If you need to refer to a control on an Outlook form within a procedure, you must also reference the inspector, page, and controls collection that contains the control, even if you are referencing the control with its own event procedure. The following example shows how to change the caption of a command button when it's clicked. To test this example, in design mode create a command button with the default name CommandButton1 on the page P.2.

Sub CommandButton1_Click 
 Set myButton = Item.GetInspector.ModifiedFormPages("P.2")_ 
 .Controls("CommandButton1") 
 myButton.Caption = "New Caption" 
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.