Link to home
Start Free TrialLog in
Avatar of edmacey
edmacey

asked on

Bold line of vba code message

In the code below an email is sent when a new project task in BCM for Outlook 2007 is created.

What I would like is for the last line, Please refer to/update task within BCM for more information/to log changes. to be in bold

Also is there the possibility of having it or other text at a different font size?

Thanks Ed.
'This emails the task contents to the assigned user. version 1.0
 
Option Explicit
Dim WithEvents inspector As inspector
Dim WithEvents project As TaskItem
Dim self As ProjectWrapper
Dim originalProjectSubject As String
 
Public Sub Init(anInspector As inspector)
    Set self = Me
    Set inspector = anInspector
    Set project = inspector.CurrentItem
End Sub
 
Private Sub inspector_Close()
    Set self = Nothing
End Sub
 
Private Sub project_Open(Cancel As Boolean)
    originalProjectSubject = project.UserProperties.Item("ParentDisplayName").Value
End Sub
 
Private Sub project_Write(Cancel As Boolean)
    Dim projectSubject As String
    projectSubject = project.UserProperties.Item("ParentDisplayName").Value
    If originalProjectSubject <> projectSubject Then
        originalProjectSubject = projectSubject
    Dim mail As MailItem
          Set mail = Application.CreateItem(olMailItem)
            mail.Subject = "Task Assigned: " & project.Subject & " for project " & projectSubject
            mail.Body = project.Owner & " has assigned you: " & project.Subject & " for project " & projectSubject & Chr(10) & "To be completed by " & project.DueDate & Chr(10) & "Comments: " & project.Body & Chr(10) & Chr(10) & "Please refer to/update task within BCM for more information/to log changes."
         mail.To = "edmacey@gmail.com"
        mail.Send
    End If
End Sub

Open in new window

Avatar of DanielWillmott
DanielWillmott
Flag of United States of America image

Try adding this...
mail.HTMLBody = project.Owner & " has assigned you: " & project.Subject & " for project " & projectSubject & Chr(10) & "To be completed by " & project.DueDate & Chr(10) & "Comments: " & project.Body & Chr(10) & Chr(10) & "<b>Please refer to/update task within BCM for more information/to log changes.</b>"

Open in new window

You may also need to add:
mail.BodyFormat = olFormatHTML
ASKER CERTIFIED SOLUTION
Avatar of DanielWillmott
DanielWillmott
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of edmacey
edmacey

ASKER

Sorry Daniel, I thought that I had accepted this yesterday with the comments "Fantastic, gives me much more functionality this way." Thanks Ed.