Turn email body to color red

aldeb

Registered User.
Local time
Yesterday, 22:43
Joined
Dec 23, 2004
Messages
318
Below is code that I have that when a CheckBox is checked
an email is sent. This works real well. I have highlighted
in red the code that I would like to turn into the color
red in the email and I do not have a clue as how to
accomplish this.

Code:
Private Sub to_kanban_Click()

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

If Me.to_kanban = True Then
Me.from_kanban.Enabled = True
Else
Me.from_kanban.Enabled = False
End If

If Me.to_kanban = True Then
Me.KanbanIssue.Enabled = True
Else
Me.KanbanIssue.Enabled = False
End If

If Me.to_kanban = False Then
Me.KanbanIssue.Enabled = False
End If

If Me.to_kanban = True Then
'SendMail7
End If

'Private Sub PartsMove_Click()

       Dim O As Outlook.Application
       Dim m As Outlook.MailItem
       Dim toEmail1 As String
       Dim toEmail2 As String
       Dim ccEmail1 As String
       Dim ccEmail2 As String
       Dim ccEmail3 As String
       Dim bccEmail1 As String
       Dim SL As String, DL As String
       SL = vbNewLine
       DL = SL & SL

If Me.to_kanban = True Then
Set O = CreateObject("Outlook.Application")
Set m = Outlook.CreateItem(0)
toEmail1 = "absroger@nmhg.com; abrproct@nmhg.com; abrroger@nmhg.com"
ccEmail1 = "abkthomp@nmhg.com"
'ccEmail2 = DLookup("LoginName", "ChangeFormUserNameTbl", "ActualName='" & Me.EcnBomAnalystAssigned & "'") & "@nmhg.com"
ccEmail3 = ""
bccEmail1 = "abajacks@nmhg.com"

m.To = toEmail1
m.CC = ccEmail1
'm.CC = ccEmail1 & ";" & ccEmail2
m.BCC = bccEmail1
m.Subject = "Form #" & Me.Form__.Value & " Kanban Material is being added, deleted or moved."
m.Body = "Form #" & Me.Form__.Value & DL & _
      [Color Red] "Request Date: " & Me.Date_Change.Value & SL & _
       "Due Date:       " & Me.soe_date_needed.Value & DL & _ [/Color]
       "Kanban Material is being added, deleted or moved:" & DL & _
       Me.What_Changed.Value & DL & _
       "Please Check all Material. If you have any questions Please contact Appropriate Engineer" & DL & _
       "Thank you," & SL & _
       DLookup("ActualName", "tblUserNameActualName", "UserName='" & GetCurrentUserName() & "'") & DL & _
       "Engineering"

m.Display
End If

End Sub
 
Why use

If Me.to_kanban = True Then
Me.from_kanban.Enabled = True
Else
Me.from_kanban.Enabled = False
End If

If Me.to_kanban = True Then
Me.KanbanIssue.Enabled = True
Else
Me.KanbanIssue.Enabled = False
End If

If Me.to_kanban = False Then
Me.KanbanIssue.Enabled = False
End If


If Me.to_kanban = True Then
'SendMail7
End If

when the following will suffice?

Me.from_kanban.Enabled = Me.to_kanban
Me.KanbanIssue.Enabled = Me.to_kanban

Items in red are repeated
 
dcrake, thanks again. Any input on my original posting as how to turn part
of the body of my email to red?
 
This is just of the top of my head (about 5ft) if you type in

m.Body.ForeColor = vbRed before you pass the text to it, this may work.

could even be m.body.TextForeColor = vbRed

Don't know what options if any are available.

Just a thought.
 
Thanks everyone, the below is working for me:

Code:
Private Sub to_kanban_Click()

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

If Me.to_kanban = True Then
Me.from_kanban.Enabled = True
Else
Me.from_kanban.Enabled = False
End If

If Me.to_kanban = True Then
Me.KanbanIssue.Enabled = True
Else
Me.KanbanIssue.Enabled = False
End If

If Me.to_kanban = False Then
Me.KanbanIssue.Enabled = False
End If

If Me.to_kanban = True Then
'SendMail7
End If

'Private Sub PartsMove_Click()

       Dim O As Outlook.Application
       Dim m As Outlook.MailItem
       Dim toEmail1 As String
       Dim toEmail2 As String
       Dim ccEmail1 As String
       Dim ccEmail2 As String
       Dim ccEmail3 As String
       Dim bccEmail1 As String
       Dim SL As String, DL As String
       'SL = vbNewLine
       'DL = SL & SL
SL = "<br>"
DL = SL & SL

If Me.to_kanban = True Then
Set O = CreateObject("Outlook.Application")
Set m = Outlook.CreateItem(0)
toEmail1 = "absroger@nmhg.com; abrproct@nmhg.com; abrroger@nmhg.com"
ccEmail1 = "abkthomp@nmhg.com"
'ccEmail2 = DLookup("LoginName", "ChangeFormUserNameTbl", "ActualName='" & Me.EcnBomAnalystAssigned & "'") & "@nmhg.com"
ccEmail3 = ""
bccEmail1 = "abajacks@nmhg.com"
m.To = toEmail1
m.CC = ccEmail1
'm.CC = ccEmail1 & ";" & ccEmail2
m.BCC = bccEmail1
m.Subject = "Form #" & Me.Form__.Value & " Kanban Material is being added, deleted or moved."
m.HTMLBody = "Form #" & Me.Form__.Value & DL & _
"<font color='#FF0000'>Request Date: " & Me.Date_Change.Value & SL & _
"Due Date:       " & Me.soe_date_needed.Value & DL & "</font>" & _
"Kanban Material is being added, deleted or moved:" & DL & _
Me.What_Changed.Value & DL & _
"Please Check all Material. If you have any questions Please contact Appropriate Engineer" & DL & _
"Thank you," & SL & _
DLookup("ActualName", "tblUserNameActualName", "UserName='" & GetCurrentUserName() & "'") & DL & _
"Engineering"

m.Display
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom