Article ID: 161924 - Last Review: February 12, 2007 - Revision: 1.3 OL97: How to Programmatically Set TextBox and CheckBox ValuesThis article was previously published under Q161924 On This PageSUMMARY
You can customize Microsoft Outlook forms by using Microsoft Visual Basic
Script and\or ActiveX controls. This article illustrates how to add
Outlook form controls and VBScript to an Outlook form. The example in this
article uses the TextBox and CheckBox controls, and with VBScript
programmatically populates those controls when you open the form.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either
expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes
that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can
help explain the functionality of a particular procedure, but they will not
modify these examples to provide added functionality or construct procedures to
meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) Customizing the Form and Adding ControlsThe following steps demonstrate how to customize a message form by making a new page visible and adding a TextBox and CheckBox control on the new page:
Binding a Field to Each ControlWhile you can manipulate the appearance of a control (color, font, etc.) with Advanced Properties, you must use a field to manipulate the value of a control (Is the CheckBox checked? What text appears inside the TextBox?).The following steps bind custom fields to each control. In this case TextBoxField is the name of the field bound to the TextBox control. CheckBoxField is the name of the field bound to the CheckBox control.
Adding VBScript to Populate the ControlsThe following steps programmatically change each control when the form opens by changing the value of the fields to which each control is bound. The value of TextBoxField changes to: "New text." The value of CheckBoxField changes to True. Therefore, the CheckBox appears checked.
Exiting the Form Design Mode and Publishing the FormBecause the programming code in this example is in the Item_Open function, it executes when you open the form. You should publish the form so that you can see the results when you open a new form.You can publish forms several ways. This example shows how to publish your form in your Inbox folder. Follow these steps to exit the design mode and publish the form:
Using the FormYou published the form in your Inbox folder, so you must open your Inbox to use the form. Follow these steps to use the form:
REFERENCES
For more information about creating solutions with Microsoft Outlook 97,
please see the following articles in the Microsoft Knowledge Base:
166368
(http://support.microsoft.com/kb/166368/EN-US/
)
OL97: How to Get Help Programming with Outlook
170783
(http://support.microsoft.com/kb/170783/EN-US/
)
OL97: Q&A: Questions about Customizing or Programming Outlook
| Article Translations
|

Back to the top
