Indeed:
rpl.Attachments.Add "C:\somefile.txt"
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"John" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>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...@gmail.com> 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)
>
>