Brian_King_of_the_North
New Member
- 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
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