PDA

View Full Version : Solved: New Reply & Reply all macro?



JeffT
05-31-2007, 03:31 PM
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

Oorang
06-01-2007, 06:46 AM
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

JeffT
06-01-2007, 03:01 PM
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

JeffT
06-02-2007, 12:15 AM
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

JeffT
06-02-2007, 01:01 AM
Changed

.Send

to

.Display

And all is well

Thanks

Oorang
06-03-2007, 12:46 PM
rofl... Well, uhm.. Glad I could help?