Using MS Outlook

aziz rasul

Active member
Local time
Today, 20:19
Joined
Jun 26, 2000
Messages
1,935
I want to include a line at the beginning of the email message that is bold, a different color and underlined. Does anyone know how to do that. Here's the code I have so far. The bit that needs to changed is highlighted in blue, etc.

strBody = "'Food: savings available to your trust from new national agreements'" & vbCrLf & vbCrLf & vbCrLf
strBody = strBody & "As you may be aware the NHS PASA food team has recently negotiated new national framework agreements for the range of ambient food products supplied via NHS Logistics." & vbCrLf & vbCrLf
strBody = strBody & "These agreements have been negotiated as part of Wave 1 of the National Contracts Procurement Project, a part of the Supply Chain Excellence Programme (SCEP)." & vbCrLf & vbCrLf
strBody = strBody & "We are now able to share with you the following information about savings available to your trust when you use these new agreements via the NHS Logistics route to market." & vbCrLf & vbCrLf
strBody = strBody & "Please find attached a report detailing the top 25 lines supplied by NHS Logistics Authority over the period April 04 to January 05, the report has then been 'annualised' to show savings by individual NPC and trust." & vbCrLf & vbCrLf
strBody = strBody & "We have also provided a further set of reports which detail the same information, but this time demonstrate savings (where applicable) achieved for ALL lines ordered by your trust via this route over the same period. This will be sent by separate email." & vbCrLf & vbCrLf
strBody = strBody & "Further reports based on spend and potential savings available if you migrate from ordering at band 1 to band 2. i.e. moving from unit to case where feasible will also be sent shortly. These will be sent by separate email." & vbCrLf & vbCrLf
strBody = strBody & "All products are available from 1 April 2005 via NHS Logistics." & vbCrLf & vbCrLf
strBody = strBody & "Should you wish to discuss further please do not hesitate to contact me." & vbCrLf
Call EmailReport(strTrustName, strDir, strCorrectName, strReportDesc, strSubject, strBody)

Code:
Public Sub EmailReport(strTrustName As String, strDir As String, strCorrectName As String, strReportDesc As String, strSubject As String, strBody)

   Dim dbs As DAO.Database
   Dim rstEmail As DAO.Recordset
   Dim strFirstName As String
   Dim strEmail As String
   Dim strReportDescription As String
   Dim intX As Integer
   Dim appOutLook As Outlook.Application
   Dim MailOutLook As Outlook.MailItem
   
   Set dbs = CurrentDb
   Set rstEmail = dbs.OpenRecordset("qryEmailAddress", dbOpenDynaset)
   
   intX = rstEmail.RecordCount
   rstEmail.MoveFirst
   
   Do While Not rstEmail.EOF
      Set appOutLook = CreateObject("Outlook.Application")
      Set MailOutLook = appOutLook.CreateItem(olMailItem)
      With MailOutLook
         strFirstName = rstEmail![FirstName]
         strEmail = rstEmail![Email Address]
         .To = strEmail
         .Subject = strSubject & strTrustName
         .Body = "Dear " & strFirstName & "," & vbCrLf & vbCrLf & strBody & vbCrLf & vbCrLf & _
         "Regards," & vbCrLf & vbCrLf & _
         "Nigel Watson" & vbCrLf & _
         "Lead Category Manager " & vbCrLf & vbCrLf & _
         "Tel: +44 (0) 1924 328842" '& vbCrLf & _
         '"NHS Purchasing & Supply Agency" & vbCrLf & _
         '"Foxbridge Way" & vbCrLf & "Normanton" & vbCrLf & _
         '"West Yorkshire" & vbCrLf & _
         '"WF6 1TL" & vbCrLf & _
         '"***email address removed***" & vbCrLf & vbCrLf
         .Attachments.Add strDir & strCorrectName
         '.Attachments.Add "u:\Reports\Covering Letter.doc"
         .Send
         Set appOutLook = Nothing
         Set MailOutLook = Nothing
      End With
      rstEmail.MoveNext
   Loop

   Set rstEmail = Nothing
   Set dbs = Nothing

End Sub
 
Last edited by a moderator:
Not sure about the formatting itself, but I know it won't work unless you include this:

.BodyFormat = olFormatRichText

somewhere between With MailOutlook and End With (before the sending part, obviously!)
 
I'll fiddle with that and repost.
 

Users who are viewing this thread

Back
Top Bottom