
I can now access the email properties with the CreateItem() method.Ġ2) Object objEmail: Using this object, I'll create an Outlook item. I have created two objects ( objOutlook and objEmail) in the beginning of the procedure.Ġ1) Object objOutlook: Using the CreateObject() function, I have initialized Outlook. You can remove the button event and run the macro when the workbook loads. Set objEmail = Nothing: Set objOutlook = NothingĪ procedure is called when you click a button. '.Send ' Send the email, when you are done. Display ' Display outlook message window. With objEmail ' Assign all email ids to the property. SHTMLBody = sTableStyle & "" & sTableHeads & "" & _ STableStyle = " table.edTable "ĭim sHTMLBody As String ' The body (in HTML format) of the email. Cells(iRows, iColCnt) & ""ĭim sSubject As String ' The subject for the email. STableData = sTableData & "" & Worksheets("Sheet1"). STableData = "" ' HTML tag to create table row.įor iColCnt = 1 To iColumnsCount ' Table data concatenated with HTML tags. ' ** ' ***** Finally, get the table data.ĭim iRowsCount, iRows As Integer ' Row counters. STableHeads = sTableHeads & "" & Worksheets("sheet1"). ' Table header concatenated with HTML tags. ' *** ' ** Now, let's get the columns for the table header.ĭim iColumnsCount, iColCnt As Integer ' Column counters. Set myDataRng = Nothing ' Clear the range.

SMail_Ids = sMail_Ids & vbCrLf & " " & cell. ' Run a loop to extract email ids from the 5nd column. End(xlUp).Row)ĭim sMail_Ids As String ' Variable to store recipients email ids. ' *** We'll now set a range (to extract email ids).

Set objOutlook = CreateObject("Outlook.Application")
