Hi everybody!
Hope you are great! I am trying to find assistance as this is urgent but no pressure haha. I have a database that sends e-mails from access trough Outlook. I need the e-mail to be send to contain HTML type and what I could do is to copy the wording that I have into a table in a field with rich text and then create a form and reference the code that I have to send the e-mail to paste the verbiage from an specific field of that form. Anyways, some of the hyperlinks are not working and I really need the verbiage to be sent in Calibri.
The code works just fine and it sends the e-mail correctly, however the font in which is sent is Times New Roman instead of Calibri. Its weird because some parts of the texts are sent in calibri and others not. I have set the fields of both table and forms to be calibri. Do you have any idea how can I make the links work and how can I make to send the e-mail with calibri? I rally do not have any idea how to send the e-mail lilke HTML, I have tried to create a template in outlook but I can not make it work, the only way that I could find was this. I would really appreciate your help in this matter, I have asked in another Forum of access but no one could help me.
here is my code, thanks in advance:
Code:
Private Sub Command43_Click()
Dim MyDB As Database
Dim MyRS As Recordset
Dim MyForm As Form
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String
Dim TheBody As String
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("Sheet2")
MyRS.MoveFirst
Set MyForm = Forms(Memo)
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
Do Until MyRS.EOF
' Create the e-mail message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![Enterprise]
TheBody = Forms!Memo!Field1
With objOutlookMsg
' Add the To recipients to the e-mail message.
Set objOutlookRecip = .Recipients.Add(TheAddress)
objOutlookRecip.Type = olBCC
' Set the Subject, the Body, and the Importance of the e-mail message.
.To = MyRS![Enterprise]
.Subject = "ACTION REQUIRED: Confirm Your Assignment Start Date"
.HTMLBody = TheBody
.Importance = olImportanceHigh 'High importance
' Resolve the name of each Recipient.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub