Removing Recipients from an automatic response

Status
Not open for further replies.
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Greetings,
I have been working on an issue for the past few days (I am not a programmer by any means) and have cobbled together the following from several different places. What I am trying to do is create the macro where it creates an email based off of a template, includes the original, addresses it to ONLY the original recipient, and delay send for to days. So far everything works except for the recipient part. I cant figure out how to have it ONLY go to the original recipient, and not those on the BCC. Any help would be great, thank you!
Sub SendNew()
Debug.Print ("Starting SendNew")
Dim recip As Outlook.Recipient

For Each SelectedItem In ActiveExplorer.Selection
If SelectedItem.Class = OlObjectClass.olMail Then
Debug.Print ("Loop found Mail Item " + TypeName(SelectedItem))
Dim item As MailItem
Set item = SelectedItem

Dim newMsg As MailItem
Set newMsg = Application.CreateItemFromTemplate("C:\Users\me\Documents\Outlook Files\TestTemplate.oft")

newMsg.HTMLBody = newMsg.HTMLBody + item.HTMLBody

For Each recip In item.Recipients

If Not recip = "xxx@domain.com" + "yyy@domain.com" Then
newMsg.Recipients.Add recip

End If

Next recip

newMsg.DeferredDeliveryTime = DateAdd("w", 2, Now)

newMsg.Display

End If
Next SelectedItem
End Sub
 

niton

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
You can filter the recipients by type

Code:
        For Each recip In item.Recipients

            If Not recip.Type = olBCC Then

                If Not recip = "xxx@domain.com" + "yyy@domain.com" Then

                    newMsg.Recipients.Add recip

                End If              

            End If

        Next recip
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
R Outlook is NOT removing attachments. Using Outlook 4
M Help sending email but removing signature via VBA Outlook VBA and Custom Forms 5
O How to paste website content using a specific font and removing URLs Using Outlook 2
M VBA Rule for removing all body but hyperlink then forwarding Outlook VBA and Custom Forms 9
N Recurring invite sent w/distribution list adding/removing attendees Using Outlook 0
A Removing illegal characters Outlook VBA and Custom Forms 2
D 'removing' an e-mail folder Using Outlook 2
G Wrong display name in from column when removing pf replication Exchange Server Administration 1
S Removing an Exchange Server account, retaining POP accounts Exchange Server Administration 1
D Removing Pop3 accounts on mulitple computers Using Outlook 3
K Removing outlines from outlook calendar Using Outlook 1
L Outlook 2007 - How to remove account without removing mail folders? Using Outlook 4
R What to backup before removing Outlook 2010? Using Outlook 4
V Outlook problem after removing avast Using Outlook 1
P Removing expired e-mail addresses Using Outlook 2
D Removing multiple Exchange 2007 servers on the same Domain and site Exchange Server Administration 1
S Removing myself as delegate from someone else's calendar Using Outlook 1
T Removing time zone setting from an appointment / meeting: is it possible? Using Outlook 2
W Reformatting calendar; removing creator name from appointments Using Outlook 3
S Removing or hiding quicklinks in owa 2010 Exchange Server Administration 1
P Viewing & Removing stats for bulk PST import Exchange Server Administration 2
A Removing local admin rights from client machines Using Outlook 2
B Trouble removing old 2000 Exchange Exchange Server Administration 4
J Removing FW: and RE: from Outlook email Subject field Using Outlook 3
M What to do after removing trial version of office 2007. Still will not take code Using Outlook 4
M Problem removing a mailbox server from a DAG. Exchange Server Administration 1
K Removing words from the Spell Check Dictionary on Outlook 10 Using Outlook 2
S in box removing read and unread emails, Using Outlook 4
S Removing/Deleting Messages from mailboxes in Exchange 2010 SP1 Exchange Server Administration 8
S Exchange 2010 not removing mailboxes Exchange Server Administration 6
G Outlook Removing Attachments Using Outlook 3
U removing mail fowarding__ Using Outlook 1
B Trouble removing old 2000 Exchange Exchange Server Administration 5
D Removing a delegates email address from a resource request. Using Outlook 1
O "Orphaned" OST file due to removing hotmail profile from Outlook account settings. Using Outlook 2
K Removing Published Calendar Using Outlook 1
C removing last legacy exchange server from org Exchange Server Administration 3
J Problem with removing mailbox database Exchange Server Administration 5
M 2010 SP1 Installation Fails on Hub Transport: Database is mandatory on UserMailbox after removing prior install of Exchange 2010 Exchange Server Administration 0
G Removing hyperlink from signature Using Outlook 1
A Removing MS Social Connector from Outlook Pane Using Outlook 1
M Removing recovery storage group exchange server 2007-problem Exchange Server Administration 4
C Default E-mail policy-removing an address Exchange Server Administration 6
C removing/adding buttons on standard taskbar Using Outlook 1
G Removing attachments from incoming emails Using Outlook 1
T Removing help links 'How to Share Calendars' on Calendar navigation bar. Using Outlook 1
C removing "Microsoft "End-User License Agreement" window BCM (Business Contact Manager) 1
S Removing "Research" menu item Outlook VBA and Custom Forms 1
R Removing first Exchange 2010 mailbox DB Exchange Server Administration 24
H removing attachments... Outlook VBA and Custom Forms 1
Similar threads


















































Top