Copy First Recipient to a Field

G

Guest

I was wondering if anyone knew how to copy the first email adressee to
another specified field. For example in my "To:" Field there is a list of
email addresses the email should go to. And what i want to do is copy the
first email address to another custom textbox. Below is my code but I can't
seem to get it to work.

Function Item_Send()
Dim i
Dim objPage
Dim objControlSentTo
i = InStr(Item.To, ";")
If i = 0 Then
i = InStr(Item.To, ",")
If i > 0 Then
Set objPage = Item.GetInspector.ModifiedFormPages("Terminated Employee
Check List")
Set objControlSentTo = Item.GetInspector.ModifiedFormPages("Terminated
Employee Check List") _
..Controls("TextBox11")

While i <> 0
objControlSentTo = Mid(Item.To, i - 1)
i = 0
Wend
End If
End Function
 
S

Sue Mosher [MVP-Outlook]

objControlSentTo.Value = Mid(Item.To, i - 1)

But this is a futile operation, because any values in unbound text boxes are not persisted when the item is sent. You should be setting an Outlook property instead. 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
 

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