Solved

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

Posted on 2011-02-25
3
1,092 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now