logo

group emails by company in outlook (C# .NET)
michael williams posted at Sunday, November 22, 2009 12:02 AM

Is there a macro for grouping emails in a folder by sender in outlook?
Reply    Reply Using Power Editor
  Rank Winnings Points
February 0 $0.00 0
January 0 $0.00 0
you can create rules in outlook
Venkat K provided a rated reply to michael williams on Sunday, November 22, 2009 5:50 AM

check this link how to create rule and move items to a folder based on some conditions:

http://office.microsoft.com/en-us/outlook/HP052428971033.aspx

 

  1. In the Navigation Pane (Navigation Pane: The column on the left side of the Outlook window that includes panes such as Shortcuts or Mail and the shortcuts or folders within each pane. Click a folder to show the items in the folder.), click Mail.
  2. On the Tools menu, click Rules and Alerts.
  3. If you have more than one e-mail account, in the Apply changes to this folder list, click the Inbox you want.
  4. Click New Rule.
    1. Click Start from a blank rule, and then click Next.
    2. Under Select when messages should be checked, select Check messages when they arrive or Check messages after sending, and then click Next.
  5. Follow the rest of the instructions in the Rules Wizard.

    If you want to run this rule on messages already in one of your folders, select the Run this rule now on messages already in "folder" check box on the last page of the Rules Wizard.

    To have this rule apply to all your e-mail accounts and Inboxes, select the Create this rule on all accounts check box on the last page of the Rules Wizard.

Thanks,

Reply    Reply Using Power Editor
  Rank Winnings Points
February 19 $0.00 19
January 25 $0.00 15

You cannot record macros in Outlook, but you can execute certain VBA snippets.
[)ia6l0 iii provided a rated reply to michael williams on Sunday, November 22, 2009 11:27 AM

  • You need to go to Tools - Macro - Macros.
  • Type a name for the macro, choose "Create".
  • The VBA Editor would open, and place your vba code in the module.
  • Save and Exit.
Back, to your vba macro snippet: The snippet would look like below:

Sub SortBySenderName()
    Dim myOlApp As New Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myFolder As Outlook.MAPIFolder
    Dim myItem As Outlook.TaskItem
    Dim myItems As Outlook.Items
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
    Set myItems = myFolder.Items
    myItems.Sort "[SenderName]", False
End Sub

Do not forget to change the folder, and the field name if you want it to be sorted by something else. 

Remember, this is only for grouping. If you need routing specific emails to specific folders, then you would need to use Rules as described above by the other member.

thanks.
Reply    Reply Using Power Editor
:-)
  Rank Winnings Points
February 1 $217.00 308
January 1 $224.00 813


Didn't Find The Answer You Were Looking For?

EggHeadCafe has experts online right now that may know the answer to your question.  We pay them a bonus for answering as many questions as they can.  So, why not help them and yourself by becoming a member (free) and ask them your question right now?
Ask Question In Live Forum

If you have an OpenID and do not want to become a member of the EggHeadCafe forum, you can also sign on to Chat Chaos and post your question to our real time Silverlight chat application.
Ask Question In Chat Chaos










  $1000 Contest    [)ia6l0 iii - $217  |  Jonathan VH - $161  |  Huggy Bear - $140  |  F Cali - $101  |  egg egg - $97  |  more Advertise  |  Privacy  |   (c) 2010