+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    09-03-2004
    Posts
    9

    Running Macro on Replying to Email

    Hey guys,

    How do I catch the Reply to Email event? I used the following code to convert the email to HTML, but I want it to run automatically so I dont have to run the macro on demand when I need to convert to HMTL.

    Code:
    Sub ReplyInHTML()
    
    
        Dim objItem As Object
        Dim objReply As MailItem
        Set objItem = GetCurrentItem()
        
        If Not (objItem Is Nothing) Then
                objItem.HTMLBody = Replace(objItem.Body, vbCrLf, "<br>")
        
        Set objReply = objItem.Reply
        objReply.Display
        End If
        
        
        Set objItem = Nothing
        Set objReply = Nothing
    End Sub

    Thanks!

  2. #2
    Registered User
    Join Date
    11-09-2008
    Location
    germany
    Posts
    74

    Re: Running Macro on Replying to Email

    There are at least two ways I can think of doing this. Here is a method that checks the the email to hit the sent items folder.

    Code:
    Private WithEvents olkFolder As Outlook.Items
     
    Private Sub Application_Quit()
        Set olkFolder = Nothing
    End Sub
     
    Private Sub Application_Startup()
        Set olkFolder = Outlook.Session.GetDefaultFolder(olFolderSentMail).Items
    End Sub
     
    Private Sub olkFolder_ItemAdd(ByVal Item As Object)
        'Change the subroutine names to match your subroutine name'
        MySubroutine
    End Sub
     
    Private Sub MySubroutine(olkItem As Object)
        'Your code goes here'
    End Sub
    I also think that you could also fire an event when the inspector (this is the window that is open for the mail) closes because an email was sent. I do not have code for that one.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0