MS OUTLOOK 2013 - Adding Sender on the CC line

Peter Berlin

Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
Hello. I am now on my final issue. Thank you!!!!!!

I have the following vb code (attached) and I am trying to add the sender automatically to the .cc line.
the Sender will change so i can't hardcode an email address automatically to the .cc line.

I currently have a specified group on the .cc line. So I would like to leave as is but add the sender as well to the .cc line.

Please help!!

Thanks, Peter

(vb in attached file)
 

Attachments

Peter Berlin

Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
Hi Diane.....

So Before:

Dim OutApp As Object
Dim OutMail As Object


Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)


On Error Resume Next
With OutMail
.SentOnBehalfOfName = "abc@email.com"
.Display
.To = dis_contacts
.CC = rok_contacts
.BCC = ""

AFTER:

Dim OutApp As Object
Dim OutMail As Object
Dim myCC As Outlook.Recipient

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set myCC = Rok_contacts.Recipients.Add("theaddress")
myCC.Type = olCC


On Error Resume Next
With OutMail
.SentOnBehalfOfName = "abc@email.com"
.Display
.To = dis_contacts
.CC = rok_contacts
.BCC = ""
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It is be like this - assuming rok_contacts is the name of a contact group that will resolve.

Set myCC = OutMail.Recipients.Add("rok_contacts")
 

Peter Berlin

Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
That is correct regarding the rok_contacts.....

ok so I now have....

Dim OutApp As Object
Dim OutMail As Object
Dim myCC As Outlook.Recipient

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set myCC = OutMail.Recipients.Add("rok_contacts")

myCC.Type = olCC

On Error Resume Next
With OutMail
.SentOnBehalfOfName = "abc@email.com"
.Display
.To = dis_contacts
.CC = rok_contacts
.BCC = ""

It returns a compile error message - user defined type not defined on the following line.
Dim myCC As Outlook.Recipient

Thanks again Diane..
 

Peter Berlin

Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
I got this working...but need to combine the two .cc lines. (semail and rok_contacts)

Dim OutApp As Object
Dim OutMail As Object


Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

Dim xOutLook As Object
Dim xNmae As Object
On Error Resume Next
Set xOutLook = CreateObject("Outlook.Application")
Set xNmae = xOutLook.GetNamespace("MAPI")
semail = xNmae.Session.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtpAddress
On Error GoTo 0


On Error Resume Next
With OutMail
.SentOnBehalfOfName = "text@abc.com"
.Display
.To = dis_contacts
.cc = semail
.cc = rok_contacts

How do I combine the 2 .cc lines??
 

Top