Hi and HELP!!
This VBA automatic reply is driving me nuts. It sort of worked occasionally but as I fiddled my way towards the desired goal it stopped working and now I cant get it to work at all (well the rule works but the script is never run) so:
I deleted the VBA module1 and the rule; Shut down and reopened outlook and started again and then:
1. Create VBA macro and copy/paste the code at http://www.slipstick.com/outlook/rules/run-script-rule-reply-message/
2. Edit the address of the oft file to point to my oft file.
3. Add the mail rule (specific words in senders address) + stop processing more rules
4 Send email to check the rule conditions (by making the action something obvious - move message to another folder) - it works!
5 Change rule action to run script (remove the move to folder part)
6 Resend email from step 4
7 Macro does not execute (.display does not display message)
8 Add action to move message to the rule
9 Resend email from step 4
10 Macro does not execute but email is moved.
11 Tear hair out!
So what am I doing wrong?
Also, it seems when it was working that the email was sent directly rather than put in the outbox? Is this the case? Is there anyway to getthe reply put in the outbox in the normal way?
Thanks for any suggestions
The macro is
Sub AutoReplywithTemplate(Item As Outlook.MailItem)
Dim oRespond As Outlook.MailItem
' Use this for a real reply
' Set oRespond = Item.Reply
' This sends a response back using a template
Set oRespond = Application.CreateItemFromTemplate("D:\Data\mail\MS-Receipt.oft")
.Subject = "Your Subject Goes Here"
.HTMLBody = "Your reply text goes here." & vbCrLf & _
"---- original body below ---" & vbCrLf & _
Item.HTMLBody & vbCrLf & _
"---- Template body below ---" & _
vbCrLf & oRespond.HTMLBody
' includes the original message as an attachment
' use this for testing, change to .send once you have it working as desired
Set oRespond = Nothing