Specify formatting of HTMLBody in and outlook message

  • Thread starter Thread starter Tigerfish
  • Start date Start date
T

Tigerfish

I have programmed a button on an Access form using VBA to automatically send
an Access report in HTML format as the body of an Outlook message. It works
as desired, keeping all the column formatting and spacing. The problem is
that long messages are truncated at the end of the first 'page' and have the
hyperlink paging buttons "First - Previous - Next - Last" at the bottom of
the message body. However, these links don't work and the report is just
truncated.

Is there any way to specify the size of the Outlook message body or turn the
paging hyperlinks off so that the entire report is included in the body of
the message. These reports are acknowledgement reports listing all materials
received for a project. They are rarely more than two report pages, but
often more than just one page.

In the past we have sent the reports as attachments but find that recipients
don't always open attachments. It would be great if we could send the
entire report in the body of the message instead.

Would appreciate any help.

Thanks.
 
For either case you'd need to edit the raw HTML in what you send to Outlook
or directly in the HTMLBody property of the mail item.
 
I apologize if my question was to vague. That's exactly what I need help
with. How do I edit the HTML or change the properties of HTML body so the
the report is not truncated. The reports are nowhere near as large as the
max size for an Outlook message. So I'm assuming there's some way to keep
Outlook from chopping off part of the message.

My code to create the HTML document from an Access report and send the email
is very simple.

stDocName = "rptConfirmTapesRecd"
stOutputDocName = code to create a document name

DoCmd.OutputTo acReport, stDocName, acFormatHTML, stOutputDocName

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(stOutputDocName, 1) 'Read in data from report
stHTMLBody = f.readall
f.Close

' Create the Outlook session
Set objOutlook = CreateObject("Outlook.Application")

' Create the message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(stProjEmail)
objOutlookRecip.Type = olTo
If intResponse = 0 Then
.BodyFormat = olFormatHTML
.Subject = "Tapes received for transcription" & " - " &
[ProjName]
.HTMLBody = stHTMLBody
End If
.Display
End With

I've searched online and Outlook Help but can't find any more info on
changing HTMLbody properties.

Any ideas?
 
HTMLBody is just a string you can retrieve from the email item. You get it
as a string and parse that string just as you would any other string, except
in this case you have to follow HTML formatting rules. No one here is going
to edit or write your HTML for you, you either have to be prepared to do
that or you need to hire someone who will do that for you.
 
I'm not asking how to write html. My question is about the size of the
Outlook email message body. Is there a way to set the size of the body so
long messages, html or rtf or plain text, are not truncated when they are
added.

Perhaps I should re-post my question with a different title. My experience
programming for Outlook has been limited to creating an Outlooking session,
creating a mail item and sending it. My question must not be very clear.
--
Michelle


Ken Slovak - said:
HTMLBody is just a string you can retrieve from the email item. You get it
as a string and parse that string just as you would any other string, except
in this case you have to follow HTML formatting rules. No one here is going
to edit or write your HTML for you, you either have to be prepared to do
that or you need to hire someone who will do that for you.




Tigerfish said:
I apologize if my question was to vague. That's exactly what I need help
with. How do I edit the HTML or change the properties of HTML body so the
the report is not truncated. The reports are nowhere near as large as the
max size for an Outlook message. So I'm assuming there's some way to keep
Outlook from chopping off part of the message.

My code to create the HTML document from an Access report and send the
email
is very simple.

stDocName = "rptConfirmTapesRecd"
stOutputDocName = code to create a document name

DoCmd.OutputTo acReport, stDocName, acFormatHTML, stOutputDocName

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(stOutputDocName, 1) 'Read in data from
report
stHTMLBody = f.readall
f.Close

' Create the Outlook session
Set objOutlook = CreateObject("Outlook.Application")

' Create the message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(stProjEmail)
objOutlookRecip.Type = olTo
If intResponse = 0 Then
.BodyFormat = olFormatHTML
.Subject = "Tapes received for transcription" & " - " &
[ProjName]
.HTMLBody = stHTMLBody
End If
.Display
End With

I've searched online and Outlook Help but can't find any more info on
changing HTMLbody properties.

Any ideas?
 
If the entire message is contained within the <body> </body> tags of the
HTML it will not be truncated. Depending on the recipient's display size for
messages and for the screen they might have to scroll to see all the message
but it will be there.
 
Back
Top