Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Send Email, As Body, With Chart?

Edit by Moderator:

There wouldn't happen to be any new ideas or developments on this problem, would there? I'm hoping to do the same as above.

Original thread is over 1 month old and therefore archive-only. Please create your own thread in future.

Thank you.

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do I Send A URL In The Body Of An Email?
Hi, I am super new to this and I cannot find info on this in my searchs. Here is what I want to do..

I am creating an Outlook mail message object. I can set the recipient, subject, and body as text, but what I want to do is to send a hyperlink/url in the body of the messge.

Any Ideas?

Here is my code:

    Dim Body As String
    Dim myOlApp As Object
    Set myOlApp = CreateObject("Outlook.Application")

    Body = "This is a neat URL: Http://"
    Set emailMsg = myOlApp.CreateItem(0)
    emailMsg.Subject = "Neat URL"
    emailMsg.Body = Body
    emailMsg.Recipients.Add ""

Maybe I should declare it differently? I do not know.... Any hlpe is greatly appreciated!


Send Email: Contactitem.body HELP!
Outlook 2000, VB 6.

Want to add functionality:

Contact and/or Journal item, send [Notes] field as email to hardcoded address(s) by

1. select text, then with control button, send

and / or

2. Using control button, send all [Notes]

How to do it?

Thank you.

Does Anybody Know How To Send An Email Which Includes Message Body?

I have an Excel file which I want to incorporate macros and VB to automatically format a report, and then email out. It's all working well apart from the fact that I can't seem to be able to include a message body in the email. At the moment, I have a 'Send' button, which uses the following code to save one particular sheet of the workbook (the sheet that contains the report) as a seperate Excel file and then email it.

Public Sub SendIBM()
Dim strDate As String
Sheets("IBM Options").Copy
strDate = Format(Date, "dd-mm-yy")
ActiveWorkbook.SaveAs "IBM Options Backlog " & strDate & ".xls"
ActiveWorkbook.SendMail Sheet1.txtEmailTo.Text, "IBM Options Backlog " & strDate
End Sub

On searching google I found this post

which seems to solve the problem for another user - but could anybody help me modify this code to work with my file? Please bear in mind that my VBA skills are pretty basic, and have only got the program working as well as it does with a lot of others people help, so if anybody can assist please can you talk in plain English with clear instructions for me?

Many thanks in advance,


Send Email From VB With The Image In Body And Not As Attachment

In outlook, you can directly insert a picture in the body of the message. Is there a way by which we can insert pictures to the body of the message using VB code. could anyone help me out as soon as possible. I dont want the image to be sent as an attachment

Thanks & Regards,
K. Sripriya

Send Excel Worksheets In Body Of Email To Different Recipients
I'm what you could call a very entry-level vb user...I'm trying to set up a macro in excel to send each worksheet within one workbook, in the body of an email, to different email addresses. I found I can do manually going to File, Send to, Mail Recipient..., but can't figure out how to please?

Send Email Text Of Body Message From Listview
hello,please help,how to send email text of body message from listview.

for example:
listview data:
user1 London 12/1/07
user2 canada 13/1/07
all the data here will send to email body message.

Private Sub cmdSendMail_Click()

With oSMTP
.Server = "" 'local email server
.AuthenticationType = AuthLogin
.UserName = ""
.Password = "system"
.MailFrom = ""
.SendTo = ""
.SendTo = ""
.MessageSubject = "Overtime confirm Alert "
.MessageText = "Listview.listitem "

End With

End Sub

Thanks for help!

Send Email Text Of Body Message From Listview
hello,please help,how to send email text of body message from listview.

for example:
listview data:
user1 London 12/1/07
user2 canada 13/1/07
all the data here will send to email body message.

Code:Private Sub cmdSendMail_Click()

   With oSMTP
    .Server = "" 'local email server
    .AuthenticationType = AuthLogin
    .UserName = ""
    .Password = "system"
    .MailFrom = ""
    .SendTo = ""
    .SendTo = ""
    .MessageSubject = "Overtime confirm Alert "
    .MessageText = "Listview.listitem "
    End With
End Sub

thanks for help!

Edited by - monchichi on 10/19/2007 11:53:55 PM

Excel To Send Chart In Email.

I have this small problem here with excel, any help will be greatly appreciated

Here is the situation:
I have an excell sheet that has some charts in it.
I want to create a small button which will choose one of them and send it as an email but in the email body, not as attachment, not as an *.xls file but as an email that consists of the chart only (maybe with some writing added to it, and / or a mail subject taken from and excel range).
Here's something that doesn't work :

Private Sub CommandButton1_Click()
Set myOutlook = CreateObject("Outlook.Application")
Set mymail = myOutlook.CreateItem(olMailItem)
mymail.Subject = "Test Mail"
mymail.HTMLBody = ActiveSheet.ChartObjects(1)
mymail.Recipients.Add "me@him.her"
End Sub

Thank you great minds!

Add Senders Email In Body Of Email - Emailing With Shellexecute
I am loking for a little help. I would like to include the senders email address in an email's body which I generate using shellexecute but after much looking can not find if or where I can get this string from? Any ideas would be much appreciated.

I am using:

strcommand = " your subject here&body=message here including senders email address."
Call ShellExecute(0&, vbNullString, strCommand, vbNullString, vbNullString, 5)

Email Body
On my form I have 2 Labels and 4 textboxes, I need to add the contents of the labels (Caption) and the text in the textboxes into my email body when I click a button.

Here's my code so far:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
ShellExecute Me.hwnd, vbNullString, ";", vbNull, vbNull, SW_SHOWNORMAL

End Sub

What code do I put after &body= or do I have the wrong code all together?

I'm running VB5

Email Body
ShellExecute 0, "Open", ""

this will open outlook with e-mail
and subject Hello

how can I also set the body in outlook to a string i choose ?


RTB And Email (&&body)
If I put this in my code:

MailBody = RTB1.Text

and send it to the body of Outlook-Express then there are not CR, how come ??

ShellExecute hwnd, "open", "" & _
"?subject=" & MailSubject$ & "&Body=" & MailBody _
, vbNullString, vbNullString, SW_SHOW

Send A Fax With Body Like *.doc Or *.txt

I download a source code from msdn ( I copy it below) and I try to send a fax with body such as *.doc or *.txt from my web application on windows 2003 server.

I can send a fax with Note, without Body. If I set FaxDocument.Body as null,
everythink is OK. But I need to send a fax with a Body (*.txt or *.doc).

If I try to define the FaxDocument.Body field, it hangs for about 5
minutes and finally comes back and says the script has timed out.

This is a source code from msdn:

Private Sub Form_Load()
Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
Dim objFaxServer As New FAXCOMEXLib.FaxServer
Dim objSender As FaxSender
Dim JobID As Variant

'Error handling
On Error GoTo Error_Handler

'Connect to the fax server
objFaxServer.Connect ""

'Set the fax body
objFaxDocument.Body = "c:DocsBody.txt"

'Name the document
objFaxDocument.DocumentName = "My First Fax"

'Set the fax priority
objFaxDocument.Priority = fptHIGH

'Add the recipient with the fax number 12225550100
objFaxDocument.Recipients.Add "12225550100", "Bud"

'Choose to attach the fax to the fax receipt
objFaxDocument.AttachFaxToReceipt = True

'Set the cover page type and the path to the cover page
objFaxDocument.CoverPageType = fcptSERVER
objFaxDocument.CoverPage = "generic"

'Provide the cover page note
objFaxDocument.Note = "Here is the info you requested"

'Provide the address for the fax receipt
objFaxDocument.ReceiptAddress = ""

'Set the receipt type to email
objFaxDocument.ReceiptType = frtMAIL

'Specify that the fax is to be sent at a particular time
objFaxDocument.ScheduleType = fstSPECIFIC_TIME
'CDate converts the time to the Date data type
objFaxDocument.ScheduleTime = CDate("4:35:47 PM")

objFaxDocument.Subject = "Today's fax"

'Set the sender properties.
objFaxDocument.Sender.Title = "Mr."
objFaxDocument.Sender.Name = "Bob"
objFaxDocument.Sender.City = "Cleveland Heights"
objFaxDocument.Sender.State = "Ohio"
objFaxDocument.Sender.Company = "Microsoft"
objFaxDocument.Sender.Country = "USA"
objFaxDocument.Sender.Email = ""
objFaxDocument.Sender.FaxNumber = "12165555554"
objFaxDocument.Sender.HomePhone = "12165555555"
objFaxDocument.Sender.OfficeLocation = "Downtown"
objFaxDocument.Sender.OfficePhone = "12165555553"
objFaxDocument.Sender.StreetAddress = "123 Main Street"
objFaxDocument.Sender.TSID = "Office fax machine"
objFaxDocument.Sender.ZipCode = "44118"
objFaxDocument.Sender.BillingCode = "23A54"
objFaxDocument.Sender.Department = "Accts Payable"

'Save sender information as default

'Submit the document to the connected fax server
'and get back the job ID.

JobID = objFaxDocument.ConnectedSubmit(objFaxServer)

MsgBox "The Job ID is :" & JobID(0)
Exit Sub

    'Implement error handling at the end of your subroutine. This implementation is for demonstration purposes
    MsgBox "Error number: " & Hex(Err.Number) & ", " & Err.Description

End Sub

Any help would be greatly appreciated.

Slawomir Malolepszy

Output To The Body Of An Email.
Hi All,

I know this has probably been asked here somewhere already, but I can't find it, and maybe you guys can help me out.

I've wrote an estimating program that realy kicks butt. Save me many hours of repeted calculations. You just put in the specs and boom, it kicks out the results to the screen or to the printer. Now I'm trying to get it dump this same info to the "body" of an email. I've got the MAPI to load and open a new email (outlook express), but for the life of me I can't get the output to flow into the body of the email. Can you guys help me out?


Pictures In Email Body
I have written a program whereby users can write nice messages in a richtextbox. It also allows for the adding of pictures, and this is where the problem comes in:

After creating their message a user is able to email it. I'm using MAPI to email it, but I don't want the message to become an attachment. It would be great if the entire message, picture and all, becomes part of the emails body (pictures are read from a server, don't worry, I believe in thin client )

I spent all weekend reading up, thinking, fretting, you name it. How do I programmatically insert text and pictures from a richtextbox into an email body, desperation is calling

Using A File For Email Body
I have been asked to put together a little script (I've never really programmed before) in LotusScript. It has to create an email where the body is composed from an existing HTML file. I can create the email fine, using the create object("Outlook.Application") and attach the file no problems.
However I have no idea how to get the body of the file into the body of the email
Any help would be greatly appreciated.

Attaching Body To Email
I have an email program that opens the default email browser inserts the email subject and body. My only problem is that the body needs to be a range of cells is there a way to do this?
Here is the code

Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL = 1
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Sub Choice1_Click()
Dim s As String
Dim hWndX As Long
hWndX = FindWindow("XLMAIN", Application.Caption)

s = ""
s = s & "?Subject=test of attachments"
s = s & "&Body=body goes here"
ShellExecute hWndX, "open", s, vbNullString, vbNullString, SW_SHOWNORMAL
End Sub

Know someone that owns a child care business. Go to It will help them greatly

.sendmail And Body Of Email
Is there any way to specify the BODY of the email message via EXCEL API?

oxlApp.Application.ActiveWorkbook.sendMail(recipient, subject)

Print Email Body Only?
is there a way to do this with a macro, or some plugin perhaps I could make in VB6?
I have seen buttons added to various other applications (word comes to mind) that have special buttons added from some third party app to preform a special function. I would like to have an online form that gets data from textboxes, creates a plain, completed form in email and sends it to through our smtp box (which I can do both of these things already)

but on certain end users, I would like to have an option to only print the body (aka the form part) and dont worry about headers and footers and all that. just the stuff in the body.

I know web and vb well enough to code something but i know nothing of integration with other apps. anyone have any ideas?

Body Text In An Email
I am using the following code to paste an Excel worksheet from a workbook into an email (Groupwise NOT Outlook!) as an attachment using the following simple code:

WB.SendMail "", "Email title"

The problem I am having is I can't get the macro to write any body text.

Can anyone help?

RichTextBox To Email Body
I have formatted text in a RTB. (colored, sized and fonts), how can I send it as the body of an email (not as an attachment). I'm sending it to Outlook, I tried .

oOutlook.HTMLBody = txtBody.TextRTF '// this method is in one continous line, unless I include html tags
oOutlook.Body = txtBody.Text '//This is formatted but no color or size

If I use html tags and the user selects an .rtf file to embed in the RTB that would be a hell of lot of parsing.

Formatting Body Of An Email
Can someone help me with formatting the body of an email message? I'm doing okay except that I need everything to appear on separate lines. The only thing in the body of the message is all the contents of a list box. Here's what I've got...

For i = 0 To List1.ListCount - 1
List1.ListIndex = i
strBody = strBody & vbCrLf & List1.Text & vbCrLf
Next i

strMailTo = "mailto:&subject=Subject&body=" & strBody
lngResult = ShellExecute(Me.hwnd, "Open", strMailTo, "", "", vbNormalFocus)

The problem is that it is going into the body of the email like this:

Line 1 Line 2 Line 3

when I need it to go like this

Line 1
Line 2
Line 3

Any help appreciated. Thanks in advance.

Shellexecute Email And Body
i know that this will open outlook and put the email address in and put hello in the message box.
how do you get the text from a textbox in the body.

ShellExecute Me.hwnd, vbNullString, "mailto:someones email@somewhere?body=Hello", vbNullString, "C:", SW_SHOWNORMAL

thank you

RichText Vb In Body Email
I would want to insert in body of an email sended via smtp the content of one richText Box of visual basic with richtext1.textRTF. it is possible to make this?

There is mime for rich text?

Email Body Length
Can someone help me out abit ....I'm using the code below for email,But after the body reaches about 500 space,letters,and or numbers it will not send.......can someone tell me what part of the code for the body do I change to add more room.....I'd like to double or triple it......

Public Function SendMail(lhWnd As Long, Optional Address As String, _
Optional Subject As String, Optional Body As String, _
Optional CC As String, Optional bcc As String, Optional Attachement As String)

Dim strCommand As String

'bygger opp "mail-strengen"
If Len(Subject) Then strCommand = "&Subject=" & Subject
If Len(Body) Then
Body = Replace(Body, "&", "%26")
Body = Replace(Body, " ", "%20")
Body = Replace(Body, vbCrLf, "%0D%0A")
Body = Replace(Body, vbCr, "%0D")
Body = Replace(Body, vbLf, "%0A")
strCommand = strCommand & "&Body=" & Body & "%0D%0A"
End If

If Len(CC) Then strCommand = strCommand & "&CC=" & CC
If Len(bcc) Then strCommand = strCommand & "&BCC=" & bcc
If Len(Attachement) Then strCommand = strCommand & "&Attacth=" & Chr(34) & Attachement & Chr(34)

'passer på at første tegn er et ?-tegn
If Len(strCommand) Then
Mid(strCommand, 1, 1) = "?"
End If

'legger til teksten "mailto:" og hoved adresse
strCommand = "mailto:" & Address & strCommand

'Starter default mail program v.h.a shellexecute
Call ShellExecute(lhWnd, "open", strCommand, _
vbNullString, vbNullString, SW_SHOWNORMAL)

End Function

Email Body Text - Help!
Ok, firstly thanks to everyone who looks at this thread and posts, as I'm finding solving my current problem not only tricky, but extremely irritating.

Basically, I am tweaking the website for the company where I work and am trying to grab information from a form which potential customers fill out, then email those fields to our email address.

The form has been written, and works fine. I've also written the script to grab the info and email it, which runs fine... problem lies with tweaking the body text to include headers which will help those who receive the emails ascertain to which field the information that has been mailed is taken (currently the form information is simply listed in the email, with a line break between each section. So, for example, the first line shows whatever the customer filled out in the 'Name' field on the form, but nothing to indicate to the email reader that that is the name field).

Incidentally, please disregard the strange field names. They are all correct, and do work, they are just thus named due to me being lazy and simply copy/pasting new fields in, rather than naming each one.

My script, which grabs from the form, is as follows. This script works perfectly, I just don't know how to add indications into the body text as to which bit of information belongs to which field.

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
Mail.FromName = Request.Form ("email")
Mail.FromAddress = Request.Form ("email3")
Mail.RemoteHost = "" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "US", ""
Mail.Subject = "Customer Request"
Mail.BodyText = Request.Form("email") & vbcrlf & Request.Form("email2") & vbcrlf & Request.Form("email4") & vbcrlf & Request.Form("email5") & vbcrlf & Request.Form("email6") & vbcrlf & Request.Form("email7") & vbcrlf & Request.Form("email72") & vbcrlf & Request.Form("email73") & vbcrlf & Request.Form("email732") & vbcrlf & Request.Form("email7322") & vbcrlf & Request.Form("email733") & vbcrlf & Request.Form("info")
if Mail.SendMail then
Response.Write "Mail send failure. Error was " & Mail.Response
end if
Set Mail = Nothing



Send Rtf In Body Of Vbsendmail
I have a vb program that contains an address book that sends emails using vbsendmail
How can i change the multiline textbox as the emails body to an rtf and send it?

Sending HTML In EMail Body
I am trying to send html formatted text in my app and I am using the winsock control. I got this code below working fine, but i cannot get it to display the html only plain text. Can anyone help?

With ctlSMTP1
' set mail server
.MailHost = ""
.MailPort = 25

' set message properties
.Subject = "Test mail from SMTP control"
.ToPerson = "My name"
.FromAddress = "" ' not a real address
.FromPerson = "Name <>"

' add addresses
.AddAddress ""

' set body
.BodyData = "<font color=green>Welcome to my email</font>" & _
vbCrLf & vbCrLf & "<h1>It is working...</h1>"

' send
End With

Email With Doc Directly In Body, Not As An Attachment
Hi everyone,
Just need to automate (working in Access) an email where the body will be something from word / excel, NOT as an attachment but directly in the body.

I tried already with DoCmd.SendObject, but the body is just a string to be written in the code:
DoCmd.SendObject , , , test@com, , , "Subject", "body is a string", False

I tried also with .body, but same problem.

Using SendKeys to paste what I copied before does not work apparently.

Any ideas are more than welcome. Thanks

Need Help Body Back Ground In Email
Hi Friends

I have a program which sends mails to the customers... I want to put a body background..

But I could view the body back ground others could not.. can any one help.. the code is follows..

Also if i give instead of body background as <img src> only i could view.

Dim objOutlook As Object
Dim objOutlookMsg As Object
dim body1 as string

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
With objOutlookMsg
.To = ""
.Subject = "Hello..."

body1 = "<html><p><b><font size=5> Dear Customer </font><b></p><p>&nbsp;</p><center><table width= 285><tr><font color=#cbfea5 size=4 align= center> </font><br><br><font color= #f80000 size=5> Have a Nice Day </font></tr></table></center><body background=cust.jpg></body></html>"
.HTMLBody = body1
'.Attachments.Add ("c:emailcuso.jpg")
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing

Attaching Excel Into The Body Of The Email..
I want to send an email(outlook object) from VB code.
In the body of that email, I would like to have an Excel work sheet. NOt as an attachement. but the body itself should have the excel file.

how can I do that programmatically do that?

Sub SendEmail()

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = ""
.CC = ""
.BCC = ""
.subject = "This is the Subject line"
.HTMLBody = SheetToHTML(ActiveSheet)
.body = Sheets("DOD Action Plan Email")


End With
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Help is greatly appreciated.


Email With Mapi: Body Message
I had writen a function to send an email from Vb using MAPI functions. The code is shown below:

With MAPIMessages1
.SessionID = MAPISession1.SessionID
.MsgIndex = -1
.RecipDisplayName = ccC
.MsgSubject = cS
.MsgNoteText = ""
.AttachmentName = Right(cDestino, 16)
.AttachmentPathName = cDestino
End With

My default email app is Incredimail.
It works fine, but always I get the same unexpected information in the body message:
Content-Type: Text/Plain


What's wrong? How I can supress that message?


Sending Email With Vb - Attachments Become Body?
I am using vb to send out emails automatically with outlook 97 and exchange server 5.5. Internally everything works great, but when emails go externally the attachment (text file) becomes part of the body of the text. I believe this code was working at one time, but stopped working a few weeks ago. Does anyone know of any patches for outlook or exchange that would cause this or if i can change my code to fix the problem? The email and my source are shown below - If anyone can help me, it would greatly be appreciated.


Sub SendEmail(attachfile, txtEmailList, txtReportName)
Dim o
Dim m
Set o = CreateObject("Outlook.Application")
Set m = o.CreateItem(0)
m.To = txtEmailList
m.Subject = txtReportName
m.Body = " "
m.Attachments.Add attachfile
'Repeat this line if there are more Attachments
'm.Send 'If you want to just send it

End Sub

Email example:

Date: Thu, 24 Apr 2003 08:15:21 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: multipart/mixed;

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

Content-Type: text/plain

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;

Application~SSN~Emp Name~Term Beg~Term End~Amount~Check~Receipt =
Proof~Grades Proof~Pay to Name =

L~01/06/2003~05/05/2003~1326~32843~01/07/2003~~Grand Valley State =
1282~xxx~RACHEL, REEDER R~03/13/2003~04/17/2003~1257~35089~~~*** =
Invalid Award Vendor 100571



This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.

Autofilling Out Body Of An Email In Outlook
Hello peeps....

My prog creates default emails at the moment with senders email and Subject lines ready populated. Is it possible (or easy) to automatically fill the body aswell and send it automatically?

Thank you oh Gods of enlightenment and beer breath.

Problem Getting Link In Body Of Email
In my asp page I am sending a an email and need to have a link in the body. The problem is that it is not showing up as a link in the email. I have tried using chr(34) as well but that doesn't work either. Any suggestions?

VB Code:
mymail.Body="At your request, the following new password has been created for the TrafficBoss Client Center:  <B>" & pass &"</B> . <BR><BR>Please use the following link to login and change your temporary password: <a href """">TrafficBoss Client Center</a>"

Can Email Body Be Formatted Using A Macro?
Hey All,

Do not do any VBA programming but have been asked to write a macro to allow users to auto-format their email body. I wrote this so far but had some questions I'm hoping you can answer. Is it best to do it the way I have and assign the formatted text to a string or should I be using the PRINT # method? Also, I wanted to test below and in Excel, using a macro you can assign the code execution to a keyboard key like 'G8' that automatically runs your code. I can not find this same functionality and think I am missing something. Writing a macro for Outlook is not the same as writing one for Excel? :

Private Sub NonConformanceTemplate()
    Dim myMail As Outlook.MailItem
    Dim strBodyFormat As String
    Set myMail = Application.CreateItem(olMailItem)
    myMail.Subject = "Non-Conformances"
    strBodyFormat = Chr(13) & _
                    Chr(13) & _
                    Chr(13) & _
                    "SOP 1.2/F7" & Chr(13) & _
                    " NON-CONFORMANCES " & Chr(13) & _
                    Chr(13) & _
                    "1.DESCRIPTION OF SITUATION/PROBLEM " & Chr(13) & _
                    "(include date of incident or date situation noticed):" & Chr(13) & _
                    Chr(13) & _
                    Chr(13) & _
                    Chr(13) & _
                    "2.NOTIFIED SUPERVISOR: Y N " & _
                    " NAME:_______________________" & _
                    " DATE:_______________________" & _
                    Chr(13) & _
                    Chr(13) & _
                    "3.CORRECTIVE ACTION TAKEN: " & _
                    Chr(13) & _
                    Chr(13) & _
                    Chr(13) & _
                    Chr(13) & _
                    Chr(13) & _
                    "Testing" & Chr(13) & _
                    "Continue under current conditions: "
    myMail.Body = strBodyFormat
End Sub

Help Sending Email With Rtf Contents As Body In Vb

I am trying to send a document using and outlook and words, The type of file i would like to send are (rtf, doc, txt) as the message body in the outlook message. Any one with experince in this area the help will be surely appreciated.

I have added the code below i get some type of hresult type error when i run this.

Public Sub SendDocMsg(ByVal subjectp As String, ByVal pEmail As String, _
    ByVal fileDirLocation As String)

        recipient = pEmail
        subject = subjectp

        Dim oLApp As Object
        Dim oItem As Object
        Dim oDoc As Object

        On Error GoTo errorHandler

        'Create a new mailitem
        ' oOutlook = New Outlook.Application
        oLApp = CreateObject("Outlook.Application")
        oItem = oLApp.CreateItem(0)
        oDoc = CreateObject("Word.Application")
        oDoc.Visible = True

        With oItem

            'Set the recipient for the new email
            .To = mRecipient

            'Set the recipient for a copy
            '.CC = ""

            'Set the subject
            .Subject = mSubject

            'The content of the document is used as the body for the email
            .Body = oDoc.ActiveDocument.Content

        End With

        MsgBox(Err.Number & " " & Err.Description)
        'Clean up
        oItem = Nothing
        oLApp = Nothing
        oDoc = Nothing

    End Sub ' SendMsg

Email Excel As Html Body
Hi, I have a excel file with data and an image inside. I would like to email the excel file as the email body via outlook (Not as attachment!) by clicking a button. I found some sample codes in the forum about how to send email but all of them are using attachment method. Can anyone provide some sample code? thanks!

Send An HTML Document As The Body
Hi, I'm sure this question has been asked in the past. I have a HTML document that I would like to send as the body of an Outlook email. I'm using VB 6 and Outlook 2000. I am currently sending this as an attachment, so I have the appropriate code for that.

Thanks, Carl

Send A Form In The Body Of Message
I have a small VB program which sends some report (or a form) as an Attachment. Is there a way to send this report in the Body of the message, so when the user opens his MS Outlook this form ( possibly HTML form or some other report) will be seen right away.

How Can I Find Out If The Email Body Is In Html Format?
i'm using msoutlook to manipulate the emails.
I want to know the way to find out that the body of the email message is written by html..
I see that outlook can tell whether the body of the message is html or plain text,. but how can i tell it programmatically?

thank you

OUTLOOK 2K/VBA Problems To Access The Email Body
Hi Dev fellows,
I am trying to grab the body of an bounced email, flagged whit a System administrator subject, using VBA.

The body of this email look like this:
....there is the email address too
Your message did not reach some or all of the intended recipients.
Subject:Web Survey (6/11/2003)
Sent: 6/11/2003 12:00 AM

The following recipient(s) could not be reached:
'' on 6/11/2003 12:09 AM
Unable to deliver the message due to a communications failure
The MTS-ID of the original message is: c=us;a= ;p=interim healthca;l=IHCMSX010306110408M2W1LN0R
MSEXCH:IMS:Interim HealthCare:IHC:IHCMSX01 3902 (000B09B6) Host Unknown
Example at


However after use:
objMail.SaveAs MyPath & MyFileName, olTXT

A new text file is created with the from, To, and Subject fields, not the body...
However for any other message I get the to, from, subject and body field.

Question: Is any reason why the body field is not been grabbed? However, if I do it manually trough File|SaveAs|as .txt file, the body part gets saved in the TXT file....

Thanks for your help pals!

Attaching File Link To Body Of An Email
I am using the VB editor within Microsoft Outlook to make an attachment stripper. I am trying to insert hyperlink to the location of where the file was saved to within the body of the email.

Does anyone know how to do this?

I tried to use the following line of code

StrmyFileLocation = "C:Documents and Settings
lellisMy Documents<file name here>
myItem.Body = myItem.Body & "file://" & StrmyFileLocation

The problem is that this creates a hyperlink but only to the point where there is a space. Therefore everything after "Documents" in the string does not get converted into the link.

I found out that whan you manually type file://filename within quotation marks the spaces are recognized.

However it doesn't seem to work when inserting a string in quotes in a VB macro as shown below:

myItem.Body = myItem.Body & Chr(34) & "file://" & StrmyFileLocation & Chr(34)

Everything after the space is not recognized.

Different Ways To Email Notes Body In Excel
Hi All,

My previous thread got moved although I think this is an Excel issue.

The code, set off with a commandbutton pops up 4 textboxes....
First one for the recipient, second for the subject.

Now, the third and fourth pop up, are textboxes that will complete a range in the workbook. I want to copy - paste this range in the body of the Email.

Isn't this possible with Lotus Notes....? Everything works in the code, just the body isn't there....

Please help!

Private Sub CommandButton1_Click()
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim vaRecipient As Variant 'Array of recipients
Dim vaSubject As Variant 'ze subjekt
Dim vaBodyCMR1 As Variant 'Bodyrange1
Dim vaBodyCMR2 As Variant 'Bodyrange2
Dim i As Long 'Counter

vaRecipient = Application.InputBox( _
Prompt:="Please enter the recipient mailaddress:" & _
vbCrLf & "(", _
Title:="Recipient", _
Loop While vaRecipient = ""

If vaRecipient = False Then Exit Sub

vaSubject = Application.InputBox( _
Prompt:="Please enter the subject:" & _
vbCrLf & "(Regarding MSO nmber 00001)", _
Title:="Recipient", _
Loop While vaSubject = ""

If vaSubject = False Then Exit Sub

vaBodyCMR1 = Application.InputBox( _
Prompt:="Please type the name/title" & _
vbCrLf & "(Sir or Michel)", _
Title:="Recipient", _
Loop While vaBodyCMR1 = ""

If vaBodyCMR1 = False Then Exit Sub

vaBodyCMR2 = Application.InputBox( _
Prompt:="Please enter the CMR FROM TO Destination:" & _
vbCrLf & "(From Pon Denmark to Finning UK)", _
Title:="Recipient", _
Loop While vaBodyCMR2 = ""

If vaBodyCMR2 = False Then Exit Sub

Range("aa1") = vaBodyCMR1
Range("aa5") = vaBodyCMR2

'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")

'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", "mailusername.nsf")
If Maildb.IsOpen = False Then
End If

'Set up the new mail document
MailDoc.Form = "Memo"
MailDoc.sendto = vaRecipient
MailDoc.Subject = vaSubject
MailDoc.Body = Worksheets("Infosheet").Range("aa1:aa14")

'This is supposed to be the property, but works
'on some systems only
'without an apparent reason of failure

'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
End If

'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0
MailDoc.Save True, True, False

End Sub


Help Sending A Worksheet Content In Email Body
Hi All,

Basically I have a workbook which keeps track of how often a list of documents are reviewed. If a document's "Last reviewed date" falls beyond 180 days, conditional formatting turns the cell red to warn the owner.

What I now want to be able to do is to automatically email the owner of those documents to tell them to take action. I've written the below but this will email the entire workbook to the user rather than just the contents (or a range thereof) of a worksheet.

Can this be achieved? If so how?

Many Thanks in advance


VB Code:
Private Sub MailDocument()'This routene mails the customerDim stDocName, User As StringDim MyMessage As ObjectUser = "cliff@clifforddashwrightdotcodotuk"ColUpdateoverdue = 9For a = 2 To Sheets.Count        Sheets(a).Activate        For x = 3 To ActiveSheet.UsedRange.Rows.Count            If Sheets(a).Cells(x, ColUpdateoverdue) = "Yes" Then            With ThisWorkbook               '.HasRoutingSlip = False                With .RoutingSlip                    .Delivery = xlAllAtOnce                    .Recipients = User                    .Subject = "These OSM Documents are due for review"                    .Message = Sheets(a).Cells(x, 8) & " Document " & Sheets(a).Cells(x, 1) & " is due for review"                    .ReturnWhenDone = False                                    End With            .Route            End With                     'just for testing only                 MsgBox Sheets(a).Cells(x, 8) & " Document " & Sheets(a).Cells(x, 1) & " is due for review"            Else            End If        Next xNext a      End Sub

Attaching A Html Document To The Body Of An Email
I am using MAPI sessions to create an interface for sending internet faxes using vb6.

Using vb6 I have created an html page. how do I attach the html page to the body of the email after it has been created without physically selecting it?

this html page is my fax cover letter

Syntax To Fill Body Of Email Message Through Vb6
HI, in my send routine for a email messaze sent through vb6 Im trying to write a line of code that says an advsier on your team has booked time off the details are as follows:" name = text2, date from = text3 and date until = text4,

I want the code to pick up the detaisl from text boxes on a form and send them as the body of the email.. the syntax im currently using is as follows..

.body = "An adviser on yout team has tried to book time off, the details are below:" and "Name" = text2.text and "Date from" = text3.text and "Date Until" = text4.text

It doesnt work so i wondered if anyone can advise on how this line of code needs to be written?

OUTLOOK 2K/VBA Problems To Access The Email Body
Hi Dev fellows,
I am trying to grab the body of an bounced email, flagged whit a System administrator subject, using VBA.

The body of this email look like this:
....there is the email address too
Your message did not reach some or all of the intended recipients.
Subject:Web Survey (6/11/2003)
Sent:6/11/2003 12:00 AM

The following recipient(s) could not be reached:
'' on 6/11/2003 12:09 AM
Unable to deliver the message due to a communications failure
The MTS-ID of the original message is: c=us;a= ;p=interim healthca;l=IHCMSX010306110408M2W1LN0R
MSEXCH:IMS:Interim HealthCare:IHC:IHCMSX01 3902 (000B09B6) Host Unknown


However after use:
objMail.SaveAs MyPath & MyFileName, olTXT

A new text file is created with the from, To, and Subject fields, not the body...
However for any other message I get the to, from, subject and body field.

Question: Is any reason why the body field is not been grabbed? However, if I do it manually trough File|SaveAs|as .txt file, the body part gets saved in the TXT file....


Thanks for your help pals!

Enclosing A Html File In The Email Body
Hi there,

I have a report in html format that need to be sent out as the body (not attachement) of the email using outlook.

In order to accomplish that I think I will have to read the html report into a string var then assign the string to htmlBody.

I am wondering if there is any simpler way to do it something like:

                                 htmlBody = myReport.html     (of course this won't work)

Thanks in advanced!


Copyright © 2005-08, All rights reserved