Creating a checkbox that will autopopulate the CC field

D

daphnejean77

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
 
S

Sue Mosher [MVP-Outlook]

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
 
D

daphnejean77

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?
 
D

daphnejean77

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.
 
H

Hollis Paul

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"
 
S

Sue Mosher [MVP-Outlook]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top