
Signature
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
> Then it was a missunderstanding on my side. I only want to use it localy
> and I was already affraid off having to use a full development environment
[quoted text clipped - 44 lines]
>>you'd want to build a COM add-in.See
>>http://www.outlookcode.com/d/comaddins.htm
As I tried to explain in my original post, the idea is that the function is
executed aoutomatically each time a new, unsent olMail item is created. I want
Outlook to set a reply-to for each outgoing email like most email programs can
do without any programming. The reason for this is that I use Outlook to
connect to two different Exchange instances, the first one is my employers'
system which I use most often, the second one is a customers exchange system
that I connect to when I am onsite there. Since I have no way to check the
exchange account at the customer site when I am not onsite and the exchange
rule that should forward every mail to my main address does not work somehow,
I would like that outlook sets the "Have replies sent to" option always to my
main account so that replys on messages send from the customers account will
not go back to this account but to the one on my employers exchange server
that I can check more often. For this I would need to trigger the macro with
the "new Mail", "Reply", Reply to all" or the forward button so that I do not
have to press a second button for each mail I send. I hope I could explain it
clearer now. Please excuse any mistakes since I am not a native english
speaker.
Best regards,
Reiner.
>The procedure you have below is a macro that can be run from a toolbar
>button or with Alt+F8. It is designed to be run while you have an item open.
>ActiveInspector will return Nothing if you don't have an item open.
>
>If you have some other scenario in mind, please provide specifics.
Sue Mosher [MVP-Outlook] - 04 Feb 2005 12:14 GMT
The problem is that you aren't keeping enough of the previous posts to make
the whole issue perfectly clear in the current message.
If you want code to run when the user creates a new message, put that code
in the Inspectors.NewInspector event handler:
Dim WithEvents colInsp As Outlook.Inspectors
Private Sub Application_Startup()
Set colInsp = Application.Inspectors
End Sub
Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
Dim objMail As Outlook.MailItem
If Inspector.CurrentItem.Class = olMail Then
Set objMail = Inspector.CurrentItem.Class
If objMail.Sent = False Then
objMail.ReplyRecipients.Add "me@mydomain.com"
End If
End If
Set objMail = Nothing
End Sub
Alternatively, you could perform the same operation when the user sends the
item by putting the code to add the reply recipient in the handler for the
Application.ItemSend event.

Signature
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
> As I tried to explain in my original post, the idea is that the function
> is
[quoted text clipped - 35 lines]
>>
>>If you have some other scenario in mind, please provide specifics.