I
Irene
Hi,
I found a couple of sample codes that I put together and everything is
working fine.
How can I access the new mail subject the same way the code access the new
mail recipient. I have tried mewitem.subject but it is returning a subject
from an old email.
Sub application_NewMail()
Dim oEmail As Object
Dim myInbox As MAPIFolder
Dim newItem As Object
Dim myRecips As Recipients
Dim myRecip As Recipient
Set myInbox = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
totalitems = myInbox.Items.Count
Set newItem = myInbox.Items.Item(1)
Set myRecips = newItem.Recipients
Set myRecip = myRecips.Item(1)
'MsgBox myRecip.Name
Set oEmail = Application.CreateItem(olMailItem)
oEmail.Subject = myRecip.Name
'oEmail.Body = newItem.Subject
oEmail.Recipients.Add "Reminder"
oEmail.Send
Set myInbox = Nothing
Set newItem = Nothing
Set myRecips = Nothing
Set myRecip = Nothing
End Sub
Thank you
Irene
I found a couple of sample codes that I put together and everything is
working fine.
How can I access the new mail subject the same way the code access the new
mail recipient. I have tried mewitem.subject but it is returning a subject
from an old email.
Sub application_NewMail()
Dim oEmail As Object
Dim myInbox As MAPIFolder
Dim newItem As Object
Dim myRecips As Recipients
Dim myRecip As Recipient
Set myInbox = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
totalitems = myInbox.Items.Count
Set newItem = myInbox.Items.Item(1)
Set myRecips = newItem.Recipients
Set myRecip = myRecips.Item(1)
'MsgBox myRecip.Name
Set oEmail = Application.CreateItem(olMailItem)
oEmail.Subject = myRecip.Name
'oEmail.Body = newItem.Subject
oEmail.Recipients.Add "Reminder"
oEmail.Send
Set myInbox = Nothing
Set newItem = Nothing
Set myRecips = Nothing
Set myRecip = Nothing
End Sub
Thank you
Irene