Creating a checkbox that will autopopulate the CC field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created some custom forms within outlook and am now looking to add
some features. One of the features I have been able to add is a checkbox
that once clicked will stamp a time and user name into a textbox field. I am
now trying to modify the below script/code to have the checkbox fill in the
CC line with the appropriate email addresses. So far this is not working and
I am at a loss, please help!
Sub CheckBox1_Click()
Dim objNS
Dim objPage
Dim objControl
Set objNS = Application.GetNamespace("MAPI")
Set objPage = Item.GetInspector.ModifiedFormPages("Order Tracking")
Set objControl = objPage.Controls("TextBox15")
objControl.Text = Now()
Set objControl = objPage.Controls("TextBox16")
objControl.Text = objNS.CurrentUser
Set objControl = Nothing
Set objPage = Nothing
Set objNS = Nothing
End Sub
 
If you want to set the Cc property, that would be:

Item.Cc = "some address"

See http://www.outlookcode.com/d/propsyntax.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
This worked and the checkbox is autopopulating the CC field, however I have
multiple check boxes and selecting the next checkbox overrides the first one
that was selected. How do I make it so once a box has been checked the
addresses will stay in the CC line and if another check box is checked it
will be added to the CC line instead of overwriting it?
 
Thank you so much this worked perfectly. I am just learning all of this as I
go and you guys have been a huge help.
 
How do I make it so once a box has been checked the
addresses will stay in the CC line and if another check box is checked it
will be added to the CC line instead of overwriting it?
Item.Mileage = Item.Cc

Item.Cc = Item.Mileage + " ; " + "some address"
 
You can append as well:

Item.Cc = Item.CC & ";" & "some address"

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top