gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,341
- Office Version
- 365
- Platform
- Windows
I have the code below that is meant to create one email and populate the that email with data from the excel workbook.
Can this code be modified so that it looks down a column in a table and if row says "SharePoint" it creates a new email each time using the data from the applicable row?
The data/table is on a tab named SharePoint. The table Name is SharePointTable The table start in B31 (headers)
Need it to look down column B for "SharePoint"
The applicable data for the emails is still coming from columns D and C of each row in the table
Thank you very much for the time and help. Greatly appreciated.
code that needs to be modified:
Can this code be modified so that it looks down a column in a table and if row says "SharePoint" it creates a new email each time using the data from the applicable row?
The data/table is on a tab named SharePoint. The table Name is SharePointTable The table start in B31 (headers)
Need it to look down column B for "SharePoint"
The applicable data for the emails is still coming from columns D and C of each row in the table
Thank you very much for the time and help. Greatly appreciated.
code that needs to be modified:
Code:
Option Explicit
Sub Mail_workbook_Outlook()
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 = "gregory.heyman@DRS.com"
.CC = ""
.BCC = ""
.Subject = "#" & Sheets("Step 7").Range("D31").Text & "#" & " " & Sheets("Step 7").Range("C31").Text
.Body = "This email will generate a new folder in Sharepoint and save this workbook there." & vbNewLine & vbNewLine & "You may add additional attachments, that you want saved to this Quote folder. " & vbNewLine & vbNewLine & "The Folder will be named after the Source ID (The email Subject)" & vbNewLine & vbNewLine & " " & vbNewLine & vbNewLine & "PLEASE DO NOT CHANGE THE SUBJECT NAME"
.Attachments.Add (Application.ActiveWorkbook.FullName)
'.Send
.display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub