Consulting

Results 1 to 4 of 4

Thread: Send response mail after categorizing

  1. #1

    Send response mail after categorizing

    Dear all,

    I wrote a macro that sends an responsemail (to the sender), with its content being different depending on what category the mail is assigned to. At the moment I have to manually trigger this macro.
    Now I am wondering if it is possible to have the response mail send automatically upon categorizing.
    It would mean that the assignment of the category starts the macro.

    Has anyone ever done something like this ?
    Any hint or help I'd be thankful for.

    Best Regards

    Daniel

  2. #2
    You could use a rule to identify and categorise the message as it arrives and use a macro script assigned to that rule to create the appropriate response and send it.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    Hi,

    the assignment of the category is done manually. the reason for this is that this is the inbox for a group of people. One of those persons will assign the email to the members of this group. This depends on who has time to take care of the subject, who knows how to do this kind of task and several other factors.

    As described after the assignment of the category I would love to respond to the sender who will take care of the issue.

  4. #4
    In that case you can assign the categories with a macro and reply accordingly e.g. as follows. Change the categories and the texts as required.

    Option Explicit
    
    Sub CategorizeAndReply()
    Dim objMail As MailItem
    Dim olItem As MailItem
    Dim olInsp As Inspector
    Dim wdDoc As Object
    Dim oRng As Object
        On Error Resume Next
        Select Case Outlook.Application.ActiveWindow.Class
            Case olInspector
                Set objMail = ActiveInspector.currentItem
            Case olExplorer
                Set objMail = Application.ActiveExplorer.Selection.Item(1)
        End Select
        objMail.ShowCategoriesDialog
        If Not objMail.Categories = "" Then
            Set olItem = objMail.Reply
            With olItem
                .BodyFormat = olFormatHTML
                Set olInsp = .GetInspector
                Set wdDoc = olInsp.WordEditor
                Set oRng = wdDoc.Range(0, 0)
                .Display
                Select Case objMail.Categories
                    Case "Category name 1"
                        oRng.Text = "This is the message for Category name 1" & vbcr & vbcr & "More message text" 'etc
                    Case "Category name 2"
                        oRng.Text = "This is the message for Category name 2"
                    Case "Category name 3"
                        oRng.Text = "This is the message for Category name 3"
                    Case "Category name 4"
                        oRng.Text = "This is the message for Category name 4"
                        'etc
                End Select
                '.Send
            End With
        Else
            Beep
            MsgBox "No category assigned"
        End If
    lbl_Exit:
        Set objMail = Nothing
        Set olItem = Nothing
        Exit Sub
    End Sub
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •