This issue has plagued my for a very long time
1 - because it drives me nuts every time I need to correct in in an email;
2- because it ought to be sooooooo easy to fix, but that evades me constantly)
the below snippet creates an Outlook email.
The problem is the paragraph format (text of the email) although the code includes:
Code:
SpaceAfter = 0, Paragraph.SpaceBefore = 0
the spacing always results in "spacing = auto" (which defaults to a double spaced paragraph - although that is not the case with emails initiated directly is Outlook);
(I'm also not certain what this portion of code does; but that's a different question for another day)
Code:
>" & Nz(varbody, "") & Format(Now) & "<
Code:
Dim olApp As Object
Dim objMail As Object
Set olApp = CreateObject("Outlook.Application") 'Create a new instance of Outlook
'Create e-mail item
Set objMail = olApp.CreateItem(0)
With objMail
'Set body format to HTML
' .bodyformat = 2
Dim vTitle As String
Dim vPrompt As String
Dim Responce As Variant
If IsNull(varaddress) Then
vTitle = "MISSING ADDRESS"
vPrompt = "Address is incorrect or missing; no email will be sent"
Responce = MsgBox(vPrompt, vbOKOnly + vbCritical, vTitle)
Exit Sub
Else
With objMail
.to = varaddress & ""
.Subject = Nz(varsubject, "")
.HTMLBody = "<span style='font:calibri, font-size:11pt, Paragraph.SpaceAfter = 0, Paragraph.SpaceBefore = 0;'>" & Nz(varbody, "") & Format(Now) & "<\span>"
.Body = Nz(varbody, "")
.Save
.Display
End With
End If
End With
Set olApp = Nothing
Set objMail = Nothing
any thoughts will be greatly appreciated in advance
m.