I have a button that sends an email using data from the text boxes on the form. The email uses HTML tags. Everything works just fine except I can't get the HTML to read if the text box has carriage returns. For example, the following 2 sentences are entered into the textbox which includes a line break after the 1st sentence:
"Areas of dense fog this morning.
Cloudy with a slight chance of rain this morning...then partly sunny this "
However, the email comes out with those two sentences on 1 line. So, is there a way for outlook to recognize when to use a break? Here's my code:
"Areas of dense fog this morning.
Cloudy with a slight chance of rain this morning...then partly sunny this "
However, the email comes out with those two sentences on 1 line. So, is there a way for outlook to recognize when to use a break? Here's my code:
Code:
Public myItem As Outlook.MailItem
Public nxtUpdate As Variant
Function SendReport()
Dim theTo, theSub, thecc As String
Dim frm As Form
Dim wCondition, wForecast, wFacilityCondition, wAreaClosings As String
Set frm = Form_frmWeatherReports
theSub = "Weather Report"
theTo = "[EMAIL="tarsha_lewis@fmminc.com"]tarsha_lewis@fmminc.com[/EMAIL]"
wCondition = frm!cboCondition & ", " & frm!cboTemp & " degrees"
wForecast = frm!Forecast
wFacilityCondition = frm!FacilityConditions
nxtUpdate = DateAdd("h", 4, Time)
Set olApplication = CreateObject("Outlook.Application")
Set olns = olApplication.GetNamespace("MAPI")
Set myItem = olApplication.CreateItem(olMailItem)
myItem.HTMLBody = "<HTML><BODY><P><b>Date:</b> " & Date & "<br>" & _
"<b>Time:</b> " & Format(Time, "h:nn AM/PM") & "</p>" & _
"<br>" & _
"<P><b>Current Weather Conditions</b><br>" & wCondition & "</p>" & _
"<br>" & _
"<P><b>Forecast</b><br>" & wForecast & "</p>" & _
"<br>" & _
"<P><b>Facilities Conditions</b><br>" & wFacilityCondition & "</p>" & _
"<br>" & _
"<P><b>Area Closings</b><br><br>" & _
"<b>Federal Government:</b> " & frm!cboOPM & "<br>" & _
"<b>State and Local Government:</b> " & frm!cboGovt & "<br>" & _
"<b>State and Local Schools:</b> " & frm!cboSchool & "</p>" & _
"<br> " & _
"<P><b>Recommended Operational Status</b><br>" & frm!cboCodes & "</p>" & _
"<br>" & _
"<P><b>Next Update</b><br>" & nxtUpdate & "</p>" _
myItem.Subject = theSub
myItem.To = "" & theTo
myItem.Display