I have the below snippet of code to create an Outlook Email.
...No issues, it does what it ought to do, with one exception:
Although the code calls for 0 spaces before or after a paragraph, the result is the spacing is set to AUTO (which in this office results in a space after every line.)
-not even certain if this is a code thing -or-an Outlook thing...
any thoughts will be greatly appreciated in advance,
m.
Code:
Public Sub SendEmail(varaddress As Variant, varsubject As String, varbody As String)
On Error Resume Next
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
End Sub