J
Joe Best
I have the following code in a module to generate an email :
Sub DoEmail(frm As Form, nID%)
Set objMail = objOutlook.CreateItem(olMailItem)
With objMail
.Subject = "NON CONFORMANCE REPORT NOTIFICATION"
.To = "jack jones;" & frm.cboActionReqdBy & ";" & frm.cboManager & ";" &
GetCurrentUser
If IsNull(frm.txtActioncomplete) Or frm.txtActioncomplete = "" Then
If Not bEditRecord Then
.Body = "Please note: A new HSL Non Conformance Report has been
recorded by " & UCase(GetCurrentUser) & vbCr & vbCr & String(140, "-") &
vbCr
Else
.Body = "Existing Non Conformance Report #" & nID & " has been
MODIFIED by " & strCurUser & vbCr & String(140, "-") & vbCr
End If
Else
If .lblClosedby = "" Then
.Subject = "NON CONFORMANCE REPORT CLOSED OUT: #" & nID
.Body = "Non Conformance Report #" & nID & " has been CLOSED OUT
by " & strCurUser & vbCr & String(140, "-") & vbCr
End If
End If
.Body = .Body & "Non Conformance Report ID:" & vbTab & Format(nID,
"000000") & vbCr
.Body = .Body & "Date/Time Recorded:" & vbTab & vbTab & Format(Now(),
"dd-mmm-yyyy hh:mm") & vbCr
.Body = .Body & "Recorded By:" & vbTab & vbTab & vbTab &
UCase(GetCurrentUser) & vbCr
.Body = .Body & "Action Required By:" & vbTab & vbTab &
frm.cboActionReqdBy & vbCr
.Body = .Body & "Manager:" & vbTab & vbTab & vbTab & frm.cboManager &
vbCr
.Body = .Body & "Director:" & vbTab & vbTab & frm.cboDirector
.Body = .Body & vbCr & String(140, "-") & vbCr
.Body = .Body & "Details of Non Conformance:" & vbCr
.Body = .Body & frm.txtNC_dtls & vbCr
.Body = .Body & String(140, "-") & vbCr
Select Case nTypeOfNCR
Case 1, 2 ' Internal & Site NCR
.Body = .Body & "Customer:" & vbTab & vbTab & vbTab &
frm.cboCustomer & vbCr
.Body = .Body & "Site:" & vbTab & vbTab & vbTab & vbTab &
frm.txtSite & vbCr
.Body = .Body & "W/O Number:" & vbTab & vbTab & vbTab &
frm.txtWO_No
If nTypeOfNCR = 1 Then ' Site Internal only
.Body = .Body & vbCr & String(140, "-") & vbCr
.Body = .Body & "Cause of Non Conformance:" & vbCr
.Body = .Body & frm.txtNC_cause & vbCr
.Body = .Body & String(140, "-") & vbCr
Else ' Gotta be site!
'.Body = .Body & "Installer:" & vbTab & vbTab & .txtInstaller
& vbCr
'.Body = .Body & "Project Manager:" & vbTab & vbTab & .txtPM
& vbCr
End If
'Case 2 ------- taken care of above... ('tho for '2, the form doesn't
yet exist!)
Case 3
Case 4
Case 5
Case 6
End Select
If frm.txtActioncomplete <> "" Then
.Body = .Body & vbCr & String(140, "-") & vbCr & vbCr
.Body = .Body & "Action Complete:" & vbTab & vbTab &
frm.txtActioncomplete & vbCr
.Body = .Body & "Details of Corrrective Action:" & frm.txtActiondtls
& vbCr
.Body = .Body & vbCr & String(140, "-") & vbCr & vbCr
End If
If .To <> "" Then .Send
End With
Set objMail = Nothing
End Sub
Question:
I would like to format the "Details of Non Conformance" text in the
following section to be bold. Any ideas how to do this please?
.Body = .Body & "Details of Non Conformance:" & vbCr
.Body = .Body & frm.txtNC_dtls & vbCr
.Body = .Body & String(140, "-") & vbCr
I am fairly new to all this and have been asked to have a look at the code
and make some amendments where required. My knowledge is fairly limited.
Many thanks,
Joe Best
Sub DoEmail(frm As Form, nID%)
Set objMail = objOutlook.CreateItem(olMailItem)
With objMail
.Subject = "NON CONFORMANCE REPORT NOTIFICATION"
.To = "jack jones;" & frm.cboActionReqdBy & ";" & frm.cboManager & ";" &
GetCurrentUser
If IsNull(frm.txtActioncomplete) Or frm.txtActioncomplete = "" Then
If Not bEditRecord Then
.Body = "Please note: A new HSL Non Conformance Report has been
recorded by " & UCase(GetCurrentUser) & vbCr & vbCr & String(140, "-") &
vbCr
Else
.Body = "Existing Non Conformance Report #" & nID & " has been
MODIFIED by " & strCurUser & vbCr & String(140, "-") & vbCr
End If
Else
If .lblClosedby = "" Then
.Subject = "NON CONFORMANCE REPORT CLOSED OUT: #" & nID
.Body = "Non Conformance Report #" & nID & " has been CLOSED OUT
by " & strCurUser & vbCr & String(140, "-") & vbCr
End If
End If
.Body = .Body & "Non Conformance Report ID:" & vbTab & Format(nID,
"000000") & vbCr
.Body = .Body & "Date/Time Recorded:" & vbTab & vbTab & Format(Now(),
"dd-mmm-yyyy hh:mm") & vbCr
.Body = .Body & "Recorded By:" & vbTab & vbTab & vbTab &
UCase(GetCurrentUser) & vbCr
.Body = .Body & "Action Required By:" & vbTab & vbTab &
frm.cboActionReqdBy & vbCr
.Body = .Body & "Manager:" & vbTab & vbTab & vbTab & frm.cboManager &
vbCr
.Body = .Body & "Director:" & vbTab & vbTab & frm.cboDirector
.Body = .Body & vbCr & String(140, "-") & vbCr
.Body = .Body & "Details of Non Conformance:" & vbCr
.Body = .Body & frm.txtNC_dtls & vbCr
.Body = .Body & String(140, "-") & vbCr
Select Case nTypeOfNCR
Case 1, 2 ' Internal & Site NCR
.Body = .Body & "Customer:" & vbTab & vbTab & vbTab &
frm.cboCustomer & vbCr
.Body = .Body & "Site:" & vbTab & vbTab & vbTab & vbTab &
frm.txtSite & vbCr
.Body = .Body & "W/O Number:" & vbTab & vbTab & vbTab &
frm.txtWO_No
If nTypeOfNCR = 1 Then ' Site Internal only
.Body = .Body & vbCr & String(140, "-") & vbCr
.Body = .Body & "Cause of Non Conformance:" & vbCr
.Body = .Body & frm.txtNC_cause & vbCr
.Body = .Body & String(140, "-") & vbCr
Else ' Gotta be site!
'.Body = .Body & "Installer:" & vbTab & vbTab & .txtInstaller
& vbCr
'.Body = .Body & "Project Manager:" & vbTab & vbTab & .txtPM
& vbCr
End If
'Case 2 ------- taken care of above... ('tho for '2, the form doesn't
yet exist!)
Case 3
Case 4
Case 5
Case 6
End Select
If frm.txtActioncomplete <> "" Then
.Body = .Body & vbCr & String(140, "-") & vbCr & vbCr
.Body = .Body & "Action Complete:" & vbTab & vbTab &
frm.txtActioncomplete & vbCr
.Body = .Body & "Details of Corrrective Action:" & frm.txtActiondtls
& vbCr
.Body = .Body & vbCr & String(140, "-") & vbCr & vbCr
End If
If .To <> "" Then .Send
End With
Set objMail = Nothing
End Sub
Question:
I would like to format the "Details of Non Conformance" text in the
following section to be bold. Any ideas how to do this please?
.Body = .Body & "Details of Non Conformance:" & vbCr
.Body = .Body & frm.txtNC_dtls & vbCr
.Body = .Body & String(140, "-") & vbCr
I am fairly new to all this and have been asked to have a look at the code
and make some amendments where required. My knowledge is fairly limited.
Many thanks,
Joe Best