Re: Rule to reply with email and attach document

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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




On Oct 2, 12:16 pm, John <john.kr...@xxxxxxxxx> wrote:
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)


.



Relevant Pages

  • Re: How to link a rule to a macro?
    ... Sue Mosher, Outlook MVP ... Dim olNS As Outlook.NameSpace ... Set olNS = Application.GetNamespace ... Set msg = olNS.GetItemFromID ...
    (microsoft.public.outlook.program_vba)
  • Re: Create Outlook - Script
    ... Dim olNS As Outlook.NameSpace ... Set olNS = Application.GetNamespace ... Set msg = olNS.GetItemFromID ... For another example of a "run a script" rule actions, ...
    (microsoft.public.outlook.program_vba)
  • RE: Auto-reply confirmation email
    ... Author of Microsoft Outlook 2007 Programming: ... Dim olNS As Outlook.NameSpace ... Set olNS = Application.GetNamespace ... Set msg = olNS.GetItemFromID ...
    (microsoft.public.outlook.program_vba)
  • Re: Rules an macro
    ... Dim strID As String ... Dim olNS As Outlook.NameSpace ... Set olNS = Application.GetNamespace ... Set msg = olNS.GetItemFromID ...
    (microsoft.public.outlook.program_vba)
  • Re: Why sending email programmatically must be so complicated?
    ... Private ol As Object ... Private Const OUTLOOK As String = "OUTLOOK" ... Dim SMTPServer As String ... Set msg = CreateObject ...
    (microsoft.public.vb.general.discussion)