![]() |
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 |
#1
|
|||
|
|||
![]()
Hi all,
I am trying to classify my mails into folders automatically when it arrives, I have used the run a script rule to achieve it. Whenever a message arrives, I want the following to happen. 1) Make a folder with the name same as the subject within the personal folder and not as subfolder in inbox 2) Move the mail to the new folder With the help of my friends on this group, I was able to make up the following code which unfortunately does not do the second part. Can somone help me to kick the macro on the back. I have tried the following olMail.Move myFolder.Parent.myDestFolder olMail.Move myDestFolder olMail.Move Parent.myDestFolder ------------------------------------------------------------------------------ Sub AutomatingClassification(MyMail As MailItem) Dim strID As String Dim olNS As Outlook.NameSpace Dim olMail As Outlook.MailItem 'Dim myFolder As Outlook.Folders 'Dim myDestFolder As Outlook.Folders strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set olMail = olNS.GetItemFromID(strID) ' MsgBox olMail.Subject Set myFolder = olNS.GetDefaultFolder(olFolderInbox) FolderName1 = olMail.Subject On Error Resume Next Set myDestFolder = myFolder.Folders(FolderName1) If myDestFolder Is Nothing Then Set myNewFolder = myFolder.Parent.Folders.Add(FolderName1) End If olMail.Move myFolder.Parent.myDestFolder Set olMail = Nothing Set olNS = Nothing End Sub -------------------------------------------------------------------------------------- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Move data folder | Leah S | Outlook - General Queries | 2 | July 31st 06 05:34 PM |
move Notes to a folder | Carl R | Outlook - General Queries | 0 | July 16th 06 07:39 PM |
move to Outlook Folder | Hlewis | Outlook and VBA | 9 | March 27th 06 01:39 PM |
Outlook Folder Move Event | Atul Sureka | Outlook and VBA | 0 | February 13th 06 05:09 AM |
Cannot move/delete messages from Sent folder | KBAR | Outlook Express | 1 | February 10th 06 03:49 PM |