|
-
Feb 14th, 2007, 08:39 AM
#1
Thread Starter
Hyperactive Member
VBA Email Font
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.
Signature Under Construction 
-
Feb 14th, 2007, 01:02 PM
#2
Addicted Member
Re: VBA Email Font
if i need to have a table in an e-mail i use Word as the e-mail container.
not tried it with code as i use the SMTP dll just for normal e-mails with attachments, but couldnt you declare word instead of outlook and create your content this way?
if you fail to plan, you plan to fail
-
Feb 15th, 2007, 04:36 AM
#3
Thread Starter
Hyperactive Member
Re: VBA Email Font
I am building the messages up in an Excel macro.
After a fairly heavy bit of processing I end up with the results, at present I just build
these up in a string, which I then use the code above to send via EMail.
I do not want to send the results as an attachment as that would significantly
increase the size of the email.
I think that it might be possible to change the font using tags of some sort, HTML?,
but I have no experience with them.
Signature Under Construction 
-
Feb 15th, 2007, 05:47 AM
#4
Addicted Member
Re: VBA Email Font
i didnt mean as a word attachment though.
if you go into word and select New>E-mail message
word is used as your e-mail program and you can insert tables.
i just wasnt sure if the sendmail dll would work with word in this way
if you fail to plan, you plan to fail
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|