Rule to reply with email and attach document

  • Thread starter Thread starter John
  • Start date Start date
J

John

Anyone have any suggestions on the best way to do this: rule applied
to a received email that replies with an email containing an
attachment. The reply is based upon the received email's subject.

I know about creating a rule and using a template. However, I don't
want to save the attachment with the template. I'm constantly updating
the file/attachment and would prefer linking/attaching the file.

For example, an email is received with "today's data" in the subject.
A rule responds by sending an email with the current data file
attached.

I'm familar with Excel/Access VBA---Outlook scripting is a bit
less...friendly. Thanks for any help!

(Sorry, I'd posted this in program_forms be accident)
 
I think I might be on a (good?) track with some code I found (Sue
Mosher) below. I've created a rule that runs this script. I should be
able to add the attachment here.


Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem
Dim rpl as Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
Set rpl = msg.Reply
rpl.Body = "some extra text" & vbCrLf & rpl.Body
rpl.Send

Set msg = Nothing
Set olNS = Nothing
End Sub
 
Back
Top