A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Rule to reply with email and attach document



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 2nd 07, 09:16 PM posted to microsoft.public.outlook.program_vba
John[_3_]
external usenet poster
 
Posts: 3
Default Rule to reply with email and attach document

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)

Ads
  #2  
Old October 2nd 07, 09:26 PM posted to microsoft.public.outlook.program_vba
John[_3_]
external usenet poster
 
Posts: 3
Default Rule to reply with email and attach document

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 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)



  #3  
Old October 3rd 07, 12:45 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Rule to reply with email and attach document

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" wrote in message ups.com...
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 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)



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I use a rule to reply to an email? RichardM Outlook and VBA 4 April 13th 07 06:58 PM
Attach a page or two of a multi-page Word 2003 document brett Outlook Express 6 December 12th 06 09:56 PM
attach publishser document on outlook to someone who doesn't have mindy Outlook - Using Contacts 1 June 12th 06 07:12 AM
Outlook 2002 "reply" and reply all with original attach ????? bma19 Outlook - Installation 1 April 7th 06 09:41 PM
Code to attach more than 1 document Jas Outlook and VBA 1 March 22nd 06 07:41 AM


All times are GMT +1. The time now is 08:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.