J
jb
using outlook 2003
would anyone have a working snippet of code to move a message matching .SenderName to
a subfolder under Inbox ?
I have a subfolder under Inbox, called Messages from TheDomain
Each incoming message is now being processed so I already have the code working fine
in capturing sendername and subject, no questions about that part
when I identify a particular sender, would like to move this particular message from
Inbox
I'm thinking that it would look something like
if instr(msg.Sendername) = "@thedomain.com" then
Set objSentFolder = obInboxFolder.Parent.Folders("Messages from TheDomain")
Item.SaveSentMessageFolder objSentFolder
end if
Do I have to separately delete the inbox message or will .SaveSentMessageFolder take
care in such a way that only one message exists in one folder ?
this was the example on microsoft site (althought the example below does it by
strSubject, not Sender)
Private Sub objOL_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objDefFolder As Outlook.MAPIFolder
Dim objSentFolder As Outlook.MAPIFolder
Set objInboxFolder = Session.GetDefaultFolder(olFolderInbox)
Set objSentFolder = obInboxFolder.Parent.Folders("Sent Mail Archive")
Dim strSubject As String
Dim strLeft As String
strSubject = Item.Subject
strLeft = Left(strSubject, 3)
If strLeft = "RE:" Then
Item.SaveSentMessageFolder objSentFolder
End If
Set objInboxFolder = Nothing
Set objSentFolder = Nothing
End Sub
would anyone have a working snippet of code to move a message matching .SenderName to
a subfolder under Inbox ?
I have a subfolder under Inbox, called Messages from TheDomain
Each incoming message is now being processed so I already have the code working fine
in capturing sendername and subject, no questions about that part
when I identify a particular sender, would like to move this particular message from
Inbox
I'm thinking that it would look something like
if instr(msg.Sendername) = "@thedomain.com" then
Set objSentFolder = obInboxFolder.Parent.Folders("Messages from TheDomain")
Item.SaveSentMessageFolder objSentFolder
end if
Do I have to separately delete the inbox message or will .SaveSentMessageFolder take
care in such a way that only one message exists in one folder ?
this was the example on microsoft site (althought the example below does it by
strSubject, not Sender)
Private Sub objOL_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objDefFolder As Outlook.MAPIFolder
Dim objSentFolder As Outlook.MAPIFolder
Set objInboxFolder = Session.GetDefaultFolder(olFolderInbox)
Set objSentFolder = obInboxFolder.Parent.Folders("Sent Mail Archive")
Dim strSubject As String
Dim strLeft As String
strSubject = Item.Subject
strLeft = Left(strSubject, 3)
If strLeft = "RE:" Then
Item.SaveSentMessageFolder objSentFolder
End If
Set objInboxFolder = Nothing
Set objSentFolder = Nothing
End Sub