none
custom follow-up vba script while creating new mails RRS feed

  • Question

  • I'm using OL 2010 and categorize my emails with some few categories to track them.

    I'd like to achieve the following:

    1) categorized emails don't get archived

    2) already categorize new emails while I create them (and not after I sent them)

    3) category only visible for me but not the recipient

    4) display the chosen category in the new mail window (so I see what I chose)

    What I've achieved so far is:

    1) not only categorize but also flag the mails as flagged mails don't get archived (hope so...)

    2 and 3) unfortunately couldn't find any VBA function to flag an email for me but not the recipient so I'm executing a GUI control (Item.GetInspector.CommandBars.FindControl(, 11634)) to flag the new email while creating it (it's the same like hitting the ribbon button to track an email without due date)

    4) if if flag an email I see a notice in the new mail window that the email is flagged - I'd like to add here the email's category but couldn't manage so

    I'd highly appreciate if anybody could guide me how to

    - flag a new mail for the sender only and set a custom flag name (i.e is there any hidden function to do so?

    - display the category in the additional information field in the new mail window above the recipient's address and below the ribbon (this shows up as soon a new mail gets flagged)

    - any other idea how to display the chosen category permanently in the new mail window (without creating new forms or something)

    I add my function to flag and categorize a new mail. This function expects a category as a parameter, sets the category and flags the message for the sender only (if the category is empty the message gets unflagged again).

    Function CategoriesButton(ByVal cat As String)
      Dim Item As Outlook.MailItem
      Dim objInsp
      Dim colCB
      Dim objCBB
      On Error Resume Next
    
      Set Item = Application.ActiveInspector.CurrentItem
      Set objInsp = Item.GetInspector
      Set colCB = objInsp.CommandBars
    
      If cat = "" Then
          Set objCBB = colCB.FindControl(, 2776)
      Else
          Set objCBB = colCB.FindControl(, 11634)
      End If
    
      If Not objCBB Is Nothing Then
          objCBB.Execute
      End If
    
      Item.Categories = cat
    
      Set objCBB = Nothing
      Set colCB = Nothing
      Set objInsp = Nothing
    
    End Function


    Best regards, Sebastian

    Saturday, May 5, 2012 6:25 PM

All replies

  • Hi spi4711,

    - flag a new mail for the sender only and set a custom flag name (i.e is there any hidden function to do so?

    What's mean of custom flag? As far as I know that you are able to use only 7 kinds of flagicon in your mail item and use red flag as usual.

    - display the category in the addtional information field in the new mail window above the recipient's address and below the ribbon (this shows up as soon a new mail gets flagged)

    - any other idea how to display the chosen category permanently in the new mail window (without creating new forms or something).

    Categroies are only used on the mail item which has been sent or received. We can't add Categroies for a mail which only stay on compose.

    I hope what I said can help you.

    Best regards,

    T.X.

    Monday, May 7, 2012 3:04 AM

  • What's mean of custom flag? As far as I know that you are able to use only 7 kinds of flagicon in your mail item and use red flag as usual.

    I mean rename it from "Follow-Up" to something else. If you do a Ctrl-Shift-G while in compose window you can rename a follow up flag to something else. Can't do it programmatically so far.

    Categroies are only used on the mail item which has been sent or received. We can't add Categroies for a mail which only stay on compose.

    Well - what I mean is:

    If I create a new mail in compose window and set a category I would like to see this chosen category on the compose window somewhere. And I'd like to avoid creating a new form for this.

    If I set a flag by Ctrl-Shift-G while in compose window I do see some additional information on the compose window right above the recipient's address. If I could add there the category with some VBA code I'd get what I meant.


    Best regards, Sebastian

    Monday, May 7, 2012 5:55 PM