You should be able to resolve names manually by clicking the Check Names button on the toolbar. What happens when you try?
Assuming the user can choose only one sponsor, you could put this code in the Item_Send event handler for the form:
Function Item_Send()
Const olCC = 2
Set recip = Item.Recipients.Add(Item.UserProperties("Sponsor"))
If recip.Resolve Then
recip.Type = olCc
Else
Item_Send = False
recip.Delete
MsgBox "The sponsor name -- " & _
Item.UserProperties("Sponsor") & _
" -- could not be resolved to an address."
End If
End Function
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
Yvetta said:
Strange thing happened. I was testing another part of this form and had
clicked on Run This Form, then I had to step away from my desk for a while.
When I came back, the name had been resolved. Apparently, there is a timing
factor somehow involved. Any thoughts on that? Anyway to have it resolve more
quickly?
--
Yvetta
Yvetta said:
I'd definitely be interested if you could help me out with that.
--
Yvetta
:
It would certainly be possible with code behind the form if you want to go that route.
Unfortunately, clicking on the Check Names button does not resolve the name.
It's very confusing that it would not even send to a valid email address.
I'll have to rethink this and see if I can come up with a different way of
accomplishing what the user wants.
Anyway, thanks for your time. It's great to have this forum and people like
yourself who are willing to help.
--
Yvetta
:
I was suggesting that you test first by manually clicking the Check Names button to see if the name you have in mind will resolve manually. If it doesn't resolve manually, it won't resolve programmatically either.
I would very much appreciate any code necessary for resolving the recipients
as you mention below. I have been looking through the books I have, and
figured that is probably what I need, but have not been able to work it out
for myself. I don't have any kind of programming background, so I pretty much
stumble through that.
We are on Outlook 2003. This will be an internal form, and will be published
to the Organizational Forms Library. Right now, I am just testing it myself.
In a custom Outlook message form, I am populating the CC field with a name
selected from a dropdown list by checking the "Set the initial value of this
field to:" checkbox on the Value properties tab of the CC field and inserting
the dropdown list name [Sponsor]. I have selected the radio button "Calculate
this formula automatically".
This works correctly. The selected name is inserted in the CC field once the
selection is made in the dropdown list. However, when the Send button is
clicked, I get an "Operation has failed" message. I have tried several
different ways of listing the names in the dropdown list, even using the SMTP
email address, but nothing works.
Can anyone help me with this problem?
Thanks in advance,