Binds an Outlook object model property to a control on an inspector.
*expression * Required. An expression that returns an Inspector object.
Control Required Object. The control that will be bound to a property.
PropertyName Required String. The name of the property that will be bound to the control.
You can also use the following line of code
myPage.Controls("bar").ItemProperty = "subject" to bind the subject property to a control. However, note that this will trigger the security warning if the property is protected by the object model security guard such as To. You can use the SetControlItemProperty method to avoid security warnings with trusted objects.
The following Visual Basic for Applications (VBA) code adds a custom page to an appointment item, adds a custom textbox control, and binds that control to Subject property.
Sub Example() Dim myIns As Outlook.Inspector Dim myAppt As Outlook.AppointmentItem Dim ctrl As Object Dim ctrls As Object Dim myPages As Outlook.Pages Dim myPage As Object Set myAppt = Application.CreateItem(olAppointmentItem) Set myIns = myAppt.GetInspector Set myPages = myIns.ModifiedFormPages Set myPage = myPages.Add("New Page") myIns.ShowFormPage ("New Page") Set ctrls = myPage.Controls Set ctrl = ctrls.Add("Forms.TextBox.1") myIns.SetControlItemProperty ctrl, "Subject" myAppt.Display End Sub
Applies to | Inspector Object