I am using the following in a number of Excel VBA macros to send out Emails.
VB Code:
Sub SendMail(ByVal ToNames As String, ByVal CCNames As String,_
ByVal vSubject As String, ByVal vMessage As String, _
ByVal AttachFile As String)
Dim OutApp As Object
Dim OutMail As Object
Const olMailItem = 0
' Sends out an Email with vMessage as the body and with the Subject as vSubject
' Sent to ToNames and CCNames, ToNames must not be blank
If ToNames = "" Then
Exit Sub
End If
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = ToNames
.cc = CCNames
.Subject = vSubject
.Body = vMessage & vbCr & vbCr
If AttachFile <> "" Then
.Attachments.Add AttachFile
End If
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
The code works perfectly, however I now need to send out an email with
data on it in the form of a table
The data is in the form of a String, and two Long's.
I would like to present it neatly, but as the font is proportional I am getting
the following results
i.e.
string1 9 8
string2 10 12
pas 8 1
Can anyone offer any suggestions as to how I can embed a commend in my
message string to use a Fixed Width font, or offer any suggestions as to how
to display a neat looking table.