Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / March 2008

Tip: Looking for answers? Try searching our database.

Rule: "Reply using a specific template" doesn't reply to Reply-To:

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mhgreene - 18 Aug 2007 04:38 GMT
I posted this in the General Questions area and based on the response that I
would need a script thought this might be the more appropiate newgroup area.

I am currently using Outlook 2003 and Windows Pro XP.

I created a rule with the action "Reply using a specific template".  The
rule functions correctly EXCEPT the response email, using the template I
created, is sent to the wrong address.

I examined the Internet Headers in the incoming message and see that the
From:  &  Reply-To:  fields have different email addresses.  I want the
"Reply using a specfic template" action to send the reply to the Reply-To:
address contained in the header, instead the action sends the email to the
From: address.

If I manually open the incoming email and click "Reply" on the menu bar, the
new message created has the correct Reply-To: adrress entered into the To:
field of the new message.

I was advised that this is the way Outlook works and I would need a script
to accomplish the desired result.

Is it possible to write a script to to be used in a rule that  could
accomplish this?  I am upgrading to Office 2007 and ordered the book  
"Microsoft Outlook 2007 Programming" by Sue Mosher.  My programming skills
are basic - any direction would be appreciated.
Thanks!
D.Lee - 20 Aug 2007 02:54 GMT
Yes, that's possible.  I'll get the code and some instructions together and
post them as quick as I can (sometime tomorrow).
Signature

David Lee - MVP Outlook

> Is it possible to write a script to to be used in a rule that  could
> accomplish this?
D.Lee - 21 Aug 2007 02:34 GMT
This should do it.  Follow these instructions to set this up.

1.  Start Outlook.
2.  Click Tools->Macro->Visual Basic Editor.
3.  If not already expanded, expand Modules and click on Module1.
4.  Copy the code below and paste it into the right-hand pane of the VB
Editor.
5.  Edit the code as needed.  I placed comment lines where things need to
change.
6.  Click the diskette icon on the toolbar to save the changes.
7.  Close the VB Editor.
8.  Click Tools->Macro->Security.
9.  Change the Security Level setting to Medium.
10.  Create a rule that runs when a new message arrives.  Set the rule to
run the macro.

Becuase this code accesses an address field and sends directly it is going
to trigger Outlook's built-in security.  That means a pop-up dialog-box each
time it fires.  Outlook security can't be turned off, but there are several
ways to work around this.  The best solution is to use Outlook Redemption
(http://www.dimastr.com).

Sub ReplyWithTemplate(Item As Outlook.MailItem)
   Dim olkReply As Outlook.MailItem, _
       olkTemplate As Outlook.MailItem
   Set olkReply = Item.Reply
   'Change the template name and path on the following line
   Set olkTemplate =
Application.CreateItemFromTemplate("C:\eeTesting\Sample Reply Template.oft")
   olkTemplate.Recipients.Add olkReply.Recipients.Item(1).Address
   olkTemplate.Recipients.ResolveAll
   olkTemplate.Send
   Set olkReply = Nothing
   Set olkTemplate = Nothing
End Sub

Signature

David Lee - MVP Outlook
!

mhgreene - 22 Aug 2007 03:16 GMT
I think I missed something!

Clicking Tools -> Macro -> Macros  shows the SaturnFirstResponse named macro
in the dialog box when the Module1 code is as shown below.  When I change the
Sub to read "Sub SaturnFirstResponse(Item as Outlook.MailItem), the named
macro disappears from the dialog box.

Sub SaturnFirstResponse()
   Dim olkReply As Outlook.MailItem, _
       olkTemplate As Outlook.MailItem
   Set olkReply = Item.Reply
   'Change the template name and path on the following line
   Set olkTemplate = Application.CreateItemFromTemplate("C:\Documents and
Settings\greenemi.HARRISAUTO\application
data\Microsoft\Templates\OneSourceSalesSaturnFirstResponse.oft")
   olkTemplate.Recipients.Add olkReply.Recipients.Item(1).Address
   olkTemplate.Recipients.ResolveAll
   olkTemplate.Send
   Set olkReply = Nothing
   Set olkTemplate = Nothing

End Sub

> This should do it.  Follow these instructions to set this up.
>
[quoted text clipped - 31 lines]
>     Set olkTemplate = Nothing
> End Sub
Erik - 24 Mar 2008 02:57 GMT
Thank you both for doing this. I have been searching and posting for 2 days -
Used D. Lee's script in Outlook 2000 and it worked perfectly!!

Now I am off to see how Outlook redemption can work around the security.

Thanks again - Erik

> I think I missed something!
>
[quoted text clipped - 54 lines]
> >     Set olkTemplate = Nothing
> > End Sub
mhgreene - 23 Aug 2007 21:52 GMT
Please disregard my post dated 8/21/2007.  I was able to work through my
misunderstanding of using the code you wrote.

The script does the job perfectly.  A million thanks!

Mike
 

> This should do it.  Follow these instructions to set this up.
>
[quoted text clipped - 31 lines]
>     Set olkTemplate = Nothing
> End Sub
Erik - 24 Mar 2008 03:14 GMT
OK - - I posted the thank you but now I have a question about Outlook
Redemption. I am a little lost. With Outlook Redemtion installed, what code
would I add to the code you already submitted (which worked perfectly!)  in
VB to bypass the security pop-up dialogue box?

Any help would be greatly appreciated (I looked at the FAQ in outlook
redemption and was a little confused to say the least)

Thank you again for your original post - Erik

> This should do it.  Follow these instructions to set this up.
>
[quoted text clipped - 31 lines]
>     Set olkTemplate = Nothing
> End Sub
Eric Legault [MVP - Outlook] - 28 Mar 2008 21:59 GMT
Take a look at this sample.  Every property/method you access with the
redemptionMailItem object will bypass any security prompts.

dim redemptionMail, outlookMail
set outlookMail= Application.CreateItem(olMailItem)
set redemptionMail = CreateObject("Redemption.SafeMailItem")
redemptionMailItem = outlookMail 'never use "Set" when setting the Item
property

Signature

Eric Legault - MVP - Outlook
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, WSS 3
Application Development, MOSS 2007 Application Development)
Blog: http://blogs.officezealot.com/legault
Try Picture Attachments Wizard for Outlook!
http://www.collaborativeinnovations.ca

> OK - - I posted the thank you but now I have a question about Outlook
> Redemption. I am a little lost. With Outlook Redemtion installed, what
[quoted text clipped - 47 lines]
>>     Set olkTemplate = Nothing
>> End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.