I am using an excel macro to pull data from an external application and generate an Outlook email message with the data that is generated. The macro works well, but the email message output is messy and difficult to align in a presentable fashion.
The macro pulls inventory counts for multiple items, then places them into a 2 column list in an email message. Currently, the columns are aligned using spaces to align the right column, but it is impossible to get a consistent and clean output, as spacing this way is dependent on font type and size on the end user's view.
Therefore, I would like to wrap the output in an HTML table to create a uniform and consistent layout for the email body.
The code that generates the data table is written as follows:
mail.Body = mail.Body & "Item Header Count Header" & Chr(10)
mail.Body = mail.Body & "Item 1 " & intCountArray(1)
mail.Body = mail.Body & "Item 2 " & intCountArray(2)
mail.Body = mail.Body & "Item 3 " & intCountArray(5)
mail.Body = mail.Body & "Item 4 " & intCountArray(3)
mail.Body = mail.Body & "Item 5 " & intCountArray(4)
mail.Body = mail.Body & "Total of Items " & intTotalFiles & Chr(10) & Chr(10)
The code above uses generic list items, actual items are of differing lengths.
I have seen some examples of code that create HTML tables, but none that match the format used in this macro.
The macro pulls inventory counts for multiple items, then places them into a 2 column list in an email message. Currently, the columns are aligned using spaces to align the right column, but it is impossible to get a consistent and clean output, as spacing this way is dependent on font type and size on the end user's view.
Therefore, I would like to wrap the output in an HTML table to create a uniform and consistent layout for the email body.
The code that generates the data table is written as follows:
mail.Body = mail.Body & "Item Header Count Header" & Chr(10)
mail.Body = mail.Body & "Item 1 " & intCountArray(1)
mail.Body = mail.Body & "Item 2 " & intCountArray(2)
mail.Body = mail.Body & "Item 3 " & intCountArray(5)
mail.Body = mail.Body & "Item 4 " & intCountArray(3)
mail.Body = mail.Body & "Item 5 " & intCountArray(4)
mail.Body = mail.Body & "Total of Items " & intTotalFiles & Chr(10) & Chr(10)
The code above uses generic list items, actual items are of differing lengths.
I have seen some examples of code that create HTML tables, but none that match the format used in this macro.