Consulting

Results 1 to 6 of 6

Thread: Solved: New Reply & Reply all macro?

  1. #1
    VBAX Contributor JeffT's Avatar
    Joined
    Oct 2004
    Location
    Maidenhead, Nr London UK
    Posts
    105
    Location

    Solved: New Reply & Reply all macro?

    Hi

    Could anybody advise the code that I need to perform the same action as the Reply & Reply All buttons. I want to run some code to insert words in the subject line on clicking buttons on the toolbar. I've got the buttons on the toolbar and the code which works, but can't make the buttons open the reply / reply all e-mails.

    I've got a "New" button which works, just need to complete the set.

    Thanks for your help

    JeffT

  2. #2
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    [VBA]Option Explicit
    Sub Test()
    Reply "I have read your message.", True
    End Sub
    Sub Reply(emailBody As String, Optional replyAll As Boolean = False)
    Dim oMI As Outlook.MailItem
    Dim oReply As Outlook.MailItem
    Set oMI = Outlook.ActiveExplorer.Selection.Item(1)
    If replyAll Then
    Set oReply = oMI.replyAll
    Else
    Set oReply = oMI.Reply
    End If
    oReply.Body = emailBody
    oReply.Send
    End Sub[/VBA]

  3. #3
    VBAX Contributor JeffT's Avatar
    Joined
    Oct 2004
    Location
    Maidenhead, Nr London UK
    Posts
    105
    Location
    Oorang

    Thanks for the reply. However I can't get this to do anything. It seem to just cycle through the two subs when running it using F8.

    I've linked it to my Test button but it still doesn't work.

    Hopefull this is simple to fix.

    Regards

    Jeff T

  4. #4
    VBAX Contributor JeffT's Avatar
    Joined
    Oct 2004
    Location
    Maidenhead, Nr London UK
    Posts
    105
    Location
    Oorang

    Ignore my previous reply, it did work I just didn't realise that it actually sent the reply with the default message. (I have receive turned off on the computer I test macros on). I was wanting the reply e-mail to open. When I checked my e-mails on my other computer early this morning I realised your code had actually sent the replies with the default message (15 times!!).

    I should have read the code as it's obvious from the last line.

    Now all I need to do is just get it to open the reply message so I can add my own message. Why I'm wanting to do this is to add our company default (reverse date eg 070602 = today) to the subject line. I know how to do that but couldn't actually open the Reply e-mail.

    Thanks

    Jeff T

  5. #5
    VBAX Contributor JeffT's Avatar
    Joined
    Oct 2004
    Location
    Maidenhead, Nr London UK
    Posts
    105
    Location
    Changed

    .Send

    to

    .Display

    And all is well

    Thanks

  6. #6
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    rofl... Well, uhm.. Glad I could help?

Posting Permissions

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