0
votes

I've created an Outlook form with several bound controls. I would like one of the check boxes when checked to make two text areas and their labels visible, then not be visible if the check box is unchecked. The controls that I want to make visible have the initial state of not-visible. I'm stuck on the VBScript syntax. I've been using Sue Mosher's Outlook programming book, but I'm a newby and I'm not getting it. I'd appreciate any help with this. I'm using Outlook 2010 on a Windows 7 machine. Thanks!

Here's my code:

Sub Item_PropertyChange(byVal Name)
Set objInsp = Item.GetInspector
Set objPage = objInsp.ModifiedFormPages("Message")
Set ckWGC = objPage.Controls("ckWGC")
Set lblState = objPage.Controls("lblState")
Set WGCState = objPage.Controls("WGCState")
Set lblCountry = objPage.Controls("lblCountry")
Set WGCCountry = objPage.Controls("WGCCountry")

If ckWGC.Value = True Then
    lblState.Visible = True
    WGCState.Visible = True
    lblCountry.Visible = True
    WGCCountry.Visible = True
Else
    lblState.Visible = False
    WGCState.Visible = False
    lblCountry.Visible = False
    WGCCountry.Visible = False
End If
End Sub 
1

1 Answers

0
votes

You would want to handle the CheckBox.Change event to capture when the user has checked or unchecked it.

Private Sub CheckBox1_Change()
End Sub