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
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