Solved

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

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
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…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

912 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

23 Experts available now in Live!

Get 1:1 Help Now