At that point, Outlook has not resolved To data into actual recipient(s) with email addresses. If you call Insp.CurrentItem.Recipients.ResolveAll or Insp.CurrentItem.Save before MsgBox Insp.CurrentItem.To, you'll get the expected result.
If you're new to Outlook VBA macros, these web pages should help you get started:
http://www.winnetmag.com/Articles/In...eID=21522&pg=1
http://www.outlookcode.com/d/vb.htm
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"geekykamikaze" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Hi, all
>
> Can anybody point me to a right direction please?
>
> I am trying to populate "TO" field in OUTLOOK XP using VBA.So before I
> get into it, I'm just playing around, as I don't have any experience
> with OUTLOOK coding.
>
> I'm trying to get it to look at the value in "To" so I can manipulate
> it, however the problem is that the value is doen't show correctly.
> When I type in a value in "To" field, the return value from the
> following code is still null. It does show the correct value after a
> few minutes. Is it because the values is stored in cache or
> something????
>
> Sub test()
> Dim App As Object
> Dim Insp As Object
>
> Set App = GetObject("", "outlook.application")
> Set Insp = App.activeinspector
> MsgBox Insp.currentitem.to
>
> End Sub
>
> This macro is attached to the session(this document)
>
> What am I doing wrong and how can I get around this?
>
> Any suggestions/feedback is appreciated.
>
> Thanks in advance!
>