Solved

Create Outlook Macro to define sender, reply-to and signature

Posted on 2011-02-25
3
1,100 Views
Last Modified: 2012-05-11
Hi,

I'm looking for a macro that in one-click would

- set the From field to a specific email address
- add a specific recipient in the CC:
- set the reply-to field to a specific email address
- insert a defined signature

Ideally the macro would allow multiple "profiles" and would prompt which profile to use when invoking the macro.
Example:

Profile 1 :
- set From: to address1@email.com
- add "addressABC@email.com" in CC:
- set reply-to address1@swift.com
- replace current signature with Sig1

Profile 2 :
- set From: to address2@swift.com
- add "addressABC@email.com" in CC:
- set reply-to address2@swift.com
- replace current signature with Sig2

and so on...

Is this something possible ?
0
Comment
Question by:CCBelux
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 34985635
Hi, CCBelux.

Yes, that's possible.  These two procedures will do everything but the signatures.  Once we have the signature issue worked  out in the other question we can use it here to add the signature.
Sub Profile1()
    Dim olkMsg As Outlook.MailItem, olkRcp As Outlook.Recipient
    Set olkMsg = Application.ActiveInspector.CurrentItem
    With olkMsg
        .SentOnBehalfOfName = "address1@email.com"
        Set olkRcp = .Recipients.Add("addressABC.email.com")
        olkRcp.Type = olCC
        .ReplyRecipients.Add "address1@swift.com"
        .Save
    End With
End Sub

Sub Profile2()
    Dim olkMsg As Outlook.MailItem, olkRcp As Outlook.Recipient
    Set olkMsg = Application.ActiveInspector.CurrentItem
    With olkMsg
        .SentOnBehalfOfName = "address2@swift.com"
        Set olkRcp = .Recipients.Add("addressABC.email.com")
        olkRcp.Type = olCC
        .ReplyRecipients.Add "address2@swift.com"
        .Save
    End With
End Sub

Open in new window

0
 

Author Closing Comment

by:CCBelux
ID: 34995887
Thanks a lot it worked like a charm.
What would be the value to add should I wish the macro to set a category as well ?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 35002392
You're welcome.  To add one or more categories, insert the following line of code anywhere between the WITH ... END WITH lines.

.Categories = "Category1,Category 2"
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolve DNS query failed errors for Exchange
Outlook Free & Paid Tools
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question