![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#6
|
|||
|
|||
![]()
You still didn't say what isn't working, nor does the code you posted
include the changes I suggested. There's no point in reposting stale code. But I did see two other things you should give some attention to: 1) SenderName won't necessarily contain an address. Use SenderEmailAddress instead. 2) You should look up the syntax for Instr() in Help, because what you have is not correct. It should be: If Instr(msg.Sendername, ") 0 Then -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "jb" wrote in message m... copy of original message ** 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) = " 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 = "" Then Item.SaveSentMessageFolder objSentFolder End If Set objInboxFolder = Nothing Set objSentFolder = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
moving emails to folders based on sender email address | Rudy L. | Outlook and VBA | 1 | December 31st 08 12:14 PM |
Journal entry fails after moving email message to folder | RobM[_2_] | Outlook - Using Contacts | 0 | December 18th 07 07:11 AM |
moving message store folder | Jeff | Outlook Express | 5 | November 1st 07 12:01 AM |
Copying/Moving/Saving an Embedded/Attached Message to a Mail Folder | B | Outlook and VBA | 1 | August 21st 07 07:46 PM |
Membership in a Distribution List should be identified in Contact | Philmont Fred | Outlook - Using Contacts | 4 | February 2nd 06 03:16 PM |