Мои электронные письма, полученные в Outlook, теряют форматирование HTML, но не при открытии электронной почты в другом приложении. Есть идеи почему?
Private Sub Command27_Click()
DoCmd.OutputTo acOutputReport, "rptInvoice", acFormatPDF, Environ("USERPROFILE") & "\Desktop\MDFInvoice.pdf"
Dim appOutLook As Object, MailOutLook As Object, insp As Object
Dim strPath As String, strFilter As String, strFile As String, vbHTML As String
vbHTML = "<html><head></head><body> Hello! </br></br>"
vbHTML = vbHTML & "This is an invoice for the MDF Funds please see below, or the attached PDF included for your record keeping purposes </br></br>"
vbHTML = vbHTML & "Kudelski Security Inc. </br>"
vbHTML = vbHTML & "Suite 100 </br>"
vbHTML = vbHTML & "Minnetonka MN 55343 </br>"
vbHTML = vbHTML & "952-543-699</br>"
vbHTML = vbHTML & "Tax ID # 41-1961338 </br></br>"
vbHTML = vbHTML & "<b>Invoice To:</b></br>"
vbHTML = vbHTML & DLookup("OrgName", "qryRptInvoice") & " </br>"
vbHTML = vbHTML & DLookup("Street", "qryRptInvoice") & " </br>"
vbHTML = vbHTML & DLookup("City", "qryRptInvoice") & " " & DLookup("State", "qryRptInvoice") & " " & DLookup("ZipCode", "qryRptInvoice") & " </br></br>"
vbHTML = vbHTML & "<b>Invoice Details: </b></br>"
vbHTML = vbHTML & "Date- " & Date & " </br>"
vbHTML = vbHTML & "Invoice # - " & DLookup("InvoiceNumber", "qryRptInvoice") & " </br>"
vbHTML = vbHTML & "Terms- " & DLookup("Terms", "qryRptInvoice") & " </br>"
vbHTML = vbHTML & "Due Date- " & DLookup("DueDate", "qryRptInvoice") & " </br>"
vbHTML = vbHTML & "Subsidiary- " & DLookup("Subsidiary", "qryRptInvoice") & " </br>"
vbHTML = vbHTML & "Currency- " & DLookup("Currency", "qryRptInvoice") & " </br>"
vbHTML = vbHTML & "Total Amount- " & Format(DSum("LineAmount", "qryRptInvoice"), "Currency") & "</body></html>"
strPath = Environ("USERPROFILE") & "\Desktop\report.pdf" 'Edit to your path
If strPath <> "" Then
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.To = Me.txtTestEmail
.Subject = "MDF Invoice Kudelski Security"
.HTMLBody = vbHTML
.BodyFormat = olFormatHTML
.Attachments.Add strPath
.Send
End With
Else
MsgBox "No file matching " & strPath & strFilter & " found." & vbCrLf & _
"Processing terminated."
Exit Sub
End If
End Sub