Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Retrieve actual value of .To without saving first? (http://www.outlookbanter.com/add-ins-outlook/78109-retrieve-actual-value-without-saving.html)

Steffen Grellmann[_2_] September 4th 08 02:54 PM

Retrieve actual value of .To without saving first?
 
Hi newsgroup,

as you can see from the code snippet below I'm trying to read the
content from the "To" field of a new Outlook mailmessage. It seems
that the item has to been saved first in order to get the \actual\
value from the .To-field.

I guess some of you will recommend to work with the Recipients
collection instead. If doing so, saving the item seems to be required
too to get actual values.

Is there another way that does not require to save the item first?

Dim itm As Object
Set itm = ActiveDocument.MailEnvelope.Item

With itm
MsgBox .To
End With

Set itm = Nothing

Kind regards,

Steffen

Sue Mosher [MVP-Outlook] September 5th 08 04:38 AM

Retrieve actual value of .To without saving first?
 
itm.Recipients.Resolve should do the same thing as saving the item -- resolve
all recipient names to actual addresses.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx



"Steffen Grellmann" wrote:

Hi newsgroup,

as you can see from the code snippet below I'm trying to read the
content from the "To" field of a new Outlook mailmessage. It seems
that the item has to been saved first in order to get the \actual\
value from the .To-field.

I guess some of you will recommend to work with the Recipients
collection instead. If doing so, saving the item seems to be required
too to get actual values.

Is there another way that does not require to save the item first?

Dim itm As Object
Set itm = ActiveDocument.MailEnvelope.Item

With itm
MsgBox .To
End With

Set itm = Nothing

Kind regards,

Steffen



All times are GMT +1. The time now is 03:45 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com