Solved

TaskItem.Body in Outlook only returns unformatted text

Posted on 2009-07-08
5
408 Views
Last Modified: 2012-05-07
I am trying to send data of a task when it is updated to a catch all email address so that we can all stay on top of task updates.
The inspector window etc is all working well, the only problem I have is that when the email is created the line breaks of the notes are not sent out.
It just looks like one big long line of text so it is not easy to discern what is the latest comment.

I can post the whole code for you if needed but this is what I am doing in short:
(The reason it looks a little bit funky is one because I have cut out loads of dimming of names and two because this is a business project with Business Contact Manager, its parent is still Task though so you can just think of it as a task).

Thanks Ed.
Private Sub project_Write(Cancel As Boolean)
Dim projectNotes As String
projectNotes = project.Body
If originalprojectNotes <> projectNotes Then
        originalprojectNotes = projectNotes
        Set mail = Application.CreateItem(olMailItem)
        mail.Subject = "" & project.Subject & " notes have been updated"
        mail.HTMLBody = "<font face='arial' colour='#000080' size='2'><p>" & project.Subject & " has been updated. The current notes are:</p><p> " & projectNotes & "</p>><p><font size = '1'>V. 1 - /4501/</p>"
        mail.To = "edmacey@iptdesign.co.uk"
        mail.Send
        End If

Open in new window

0
Comment
Question by:edmacey
  • 3
  • 2
5 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 24804784
Hi, Ed.

Use the Replace function to convert the returns to HTML <br> tags.  Something like this


Private Sub project_Write(Cancel As Boolean)
Dim projectNotes As String
projectNotes = project.Body
If originalprojectNotes <> projectNotes Then
        originalprojectNotes = projectNotes
        Set mail = Application.CreateItem(olMailItem)
        mail.Subject = "" & project.Subject & " notes have been updated"
        mail.HTMLBody = "<font face='arial' colour='#000080' size='2'><p>" & project.Subject & " has been updated. The current notes are:</p><p> " & Replace(projectNotes, vbCrLf, "<br>") & "</p>><p><font size = '1'>V. 1 - /4501/</p>"
        mail.To = "edmacey@iptdesign.co.uk"
        mail.Send
        End If

Open in new window

0
 

Author Comment

by:edmacey
ID: 24805029
Once again sir, you are a genius. That has worked fantastically. Thanks Ed.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24805702
Thanks and you're welcome.
0
 

Author Closing Comment

by:edmacey
ID: 31601150
Sorry I though tmy genius comment was me accepting it, i;m doing far too many things at once. Thanks again. Ed.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24809040
No problem, Ed.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question