I am running the VBA code below from MS Access 97. We are trying to send to our customer an email with a html format in the body. When the body of this email is blank the code runs fine, but when I add the html code under Vbody it doesn't work. We are also trying to pull the Lease# from the form we use to send this email and add it to the body.
How can I do this? Thank you for helping me.
Tam
---------------
Function SendEmail()
Dim VFile As Variant
Dim i As Integer
Dim VDir, vBody, vTo, vSubject As String
Dim oOutlook As Outlook.Application
Dim oMessage As Outlook.MailItem
Set oOutlook = CreateObject("Outlook.Application"
Set oMessage = oOutlook.CreateItem(olMailItem)
vTo = "MyEmail@email.com"
vSubject = "Thank you for the order"
vBody = <html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>Lease# & Forms![ScheduleMainForm]![lease#] & Order Status</p>
<p>We have repeatedly attempted to secure payment of the balance due of
$1,000 regarding the leases listed above. Your accounts have been
placed on FINAL DEMAND status for default of payment. We demand full payment
within ten days of receipt of this letter, or your account will be placed in
legal status for whatever action is necessary to obtain payment. </p>
</body>
</html>
With oMessage
.To = vTo
.Subject = vSubject
.Body = vBody & vbCrLf
.Display
End With
End Function
How can I do this? Thank you for helping me.
Tam
---------------
Function SendEmail()
Dim VFile As Variant
Dim i As Integer
Dim VDir, vBody, vTo, vSubject As String
Dim oOutlook As Outlook.Application
Dim oMessage As Outlook.MailItem
Set oOutlook = CreateObject("Outlook.Application"
Set oMessage = oOutlook.CreateItem(olMailItem)
vTo = "MyEmail@email.com"
vSubject = "Thank you for the order"
vBody = <html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>Lease# & Forms![ScheduleMainForm]![lease#] & Order Status</p>
<p>We have repeatedly attempted to secure payment of the balance due of
$1,000 regarding the leases listed above. Your accounts have been
placed on FINAL DEMAND status for default of payment. We demand full payment
within ten days of receipt of this letter, or your account will be placed in
legal status for whatever action is necessary to obtain payment. </p>
</body>
</html>
With oMessage
.To = vTo
.Subject = vSubject
.Body = vBody & vbCrLf
.Display
End With
End Function