VBA Code that CC active sheet to email address within a cell

kets23

New Member
Joined
Feb 29, 2016
Messages
26
Hi

Would be grateful for any assistance with the following:

I have a spreadsheet with data on and a submit button, when this submit button is clicked, the below VBA code attaches the spreadsheet and emails the file to the address shown in the to box using outlook. This all works fine.

However, I also want it to look at a cell reference within the spreadsheet i.e. C10 which has an email address. When submit button is clicked, I want the code to send the file to the email address already shown in the code (in the To box, which is a fixed email address and uses the code below) but also want the email address shown in cell C10 to be in the CC field of outlook. The email address in cell C10 will differ as its' based on a value from a Vlook up.

Any guidance on the code required to be added to the below would be very much appreciated.

Sub Mail_workbook_Outlook_1()
Dim OutApp As Object
Dim OutMail As Object


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


On Error Resume Next
With OutMail
.to = "kevin.philips@hotmail.co.uk"
.CC = ""
.BCC = ""
.Subject = "Order Requition"
.Body = "Hi there, please process the attached request, many thanks"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0


Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Many thanks
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top