Hi. I am at the tearing hair out stage. I had set up email confirmation from a form and it was going fine. Initially used a PDF attachment but that contact person left and now the new person wants the confirmation incorporated into the body of the email (not a bad judgement) but they also want some text formatted into bold and also their logo incorporated into the body of the email.
I had moved it to using the body message as effectively a long string which laid all out quite nicely, but not nicely enough! As far as I can see to get the bold and image I need to move to HTML and struggling.
This is my current code
Can anyone advise/point me in right direction to add formatting and embed image before I have no hair left???
Thanks
I had moved it to using the body message as effectively a long string which laid all out quite nicely, but not nicely enough! As far as I can see to get the bold and image I need to move to HTML and struggling.
This is my current code
Code:
' If a booking then ascertain if confirmation to be sent now
varResponse = MsgBox("Do you wish to send an appropriate confirmation now?" & vbLf & vbLf & "You are able to do it later when reviewing bookings for the course.", vbYesNo, "Confirm booking now?")
If varResponse = vbYes Then
' Determine if email address available
If Not IsNull(Me.txtEmail) Then
bSent = True
' Identify variables
strName = DLookup("FullName", "qryBookingConf")
strEvent = "XXXXXXXXXXXXX - " & DLookup("Event", "qryBookingConf") & vbLf & DLookup("strEv", "tblEvents", "lngEv = " & Me.cboTrEvent & "")
strBlock1 = strName & vbLf & Nz(DLookup("strOrg", "qryBookingConf")) & CR & Format(Date, "dddd"", ""d mmmm yyyy") & CR & CR & "Dear " & strName & CR & strEvent
strVenue = "Venue:" & vbLf & DLookup("strVen", "qryBookingConf") & vbLf & Nz(DLookup("strVenAddr1", "qryBookingConf")) & vbLf & Nz(DLookup("strVenAddr2", "qryBookingConf")) & vbLf & DLookup("VenTown", "qryBookingConf") & vbLf & DLookup("strVenPc", "qryBookingConf")
strTimes = "Times:" & vbLf & "Registration and coffee " & DLookup("dtmEvStart", "qryBookingConf") & vbLf & "Start " & DLookup("dtmEvCommence", "qryBookingConf") & vbLf & "Finish " & DLookup("dtmEvEnd", "qryBookingConf")
strBlock3 = DLookup("strEmText", "tblEmailTexts", "lngEm = 4") & CR & DLookup("strEmText", "tblEmailTexts", "lngEm = 5") & CR & DLookup("strEmText", "tblEmailTexts", "lngEm = 6")
strSignature = "XXXX" & vbLf & "XXXXX" & vbLf & "XXX Street" & vbLf & "EDINBURGH" & vbLf & "EH" & CR & "Tel: 0131 " & vbLf & "Fax: 0" & vbLf & "Web: www.xxxx.uk"
' Determine which confirmation is to be sent
If Me.cboStatus = 1 Then
strBlock2 = DLookup("strEmText", "tblEmailTexts", "lngEm = 8") & " " & DLookup("strEvT", "qryBookingConf") & " " & DLookup("strEmText", "tblEmailTexts", "lngEm = 7")
ElseIf Me.cboStatus = 5 Then
strBlock2 = DLookup("strEmText", "tblEmailTexts", "lngEm = 9") & " " & DLookup("strEvT", "qryBookingConf") & " " & DLookup("strEmText", "tblEmailTexts", "lngEm = 10")
ElseIf Me.cboStatus = 7 Then
strBlock2 = DLookup("strEmText", "tblEmailTexts", "lngEm = 1") & " " & DLookup("strEvT", "qryBookingConf") & " " & DLookup("strEmText", "tblEmailTexts", "lngEm = 2")
End If
' Set up the message
strMessage = strBlock1 & CR & strBlock2 & CR & strVenue & CR & strTimes & CR & strBlock3 & CR & "Kind regards." & CR & CR & strSignature
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(Me.txtEmail)
objOutlookRecip.Type = olTo
objOutlookRecip.Resolve
' Set the Subject, Body, and Importance of the message.
.Subject = "XXXX booking confirmation"
.Body = strMessage
.Importance = olImportanceHigh 'High importance
' Send the message
.Send
End With
Can anyone advise/point me in right direction to add formatting and embed image before I have no hair left???
Thanks