Hello,
I have created a e-mail solution for a customer.
The e-mail is HTML format.
The program creates the body and add a signatur at the end.
The signature is a HTML file that is added to the body.
All is working fine if Word is not the e-mail editor.
If I turn on Word as E-mail editor then the signature is shown but the rest of the text is gone.
The customer want to use Word as e-mail editor. So simply turning that of is no option
Does anyone have a solution for me
Thanks in advance
Ernst Jan
Code for making e-mail:
Code for adding signature
Sorry for Dutch comment rows
I have created a e-mail solution for a customer.
The e-mail is HTML format.
The program creates the body and add a signatur at the end.
The signature is a HTML file that is added to the body.
All is working fine if Word is not the e-mail editor.
If I turn on Word as E-mail editor then the signature is shown but the rest of the text is gone.
The customer want to use Word as e-mail editor. So simply turning that of is no option
Does anyone have a solution for me
Thanks in advance
Ernst Jan
Code for making e-mail:
Code:
'Gegevens opvragen
Set tblBron = CurrentDb.OpenRecordset("SELECT * FROM qryOverzichtOpenstaandeCalls WHERE " & varFilter)
'E-Bericht opbouwen
' Aanhef
varbericht = varbericht & "<body>" & _
"<font face='Trebuchet MS' Size=2>" & _
"Beste " & IIf(IsNull(Me.keuzeLeverancier.Column(varAanhef)) Or Me.keuzeLeverancier.Column(varAanhef) = "", "heer/mevrouw,", Me.keuzeLeverancier.Column(varAanhef) & ",") & "<Br><br>" & _
"Hierbij de openstaande punten per " & Format(Now(), "dd-mmm-yyyy") & ", " & Format(Now(), "hh:mm") & " uur: <br><br>" & varbericht
' Regels invoegen
Do Until tblBron.EOF
varbericht = varbericht & "<b>Onze Ref. : </b>" & tblBron!Call_ID & "<br>"
varbericht = varbericht & "<b>Uw Ref. : </b>" & tblBron!Referentie & "<br>"
varbericht = varbericht & "<b>Prioriteit : </b>" & tblBron!Prio & "<br>"
varbericht = varbericht & "<b>Omschrijving : </b>" & tblBron!KorteOmschrijving & "<br><br>"
'Volgende regel
tblBron.MoveNext
Loop
'gegevens tabel sluiten
tblBron.Close
'Handtekening toevoegen
varbericht = EmailBericht(varbericht)
'Controleren of er een email adres beschikbaar is
If Me.keuzeLeverancier.Column(varEmail) <> "" And Not IsNull(Me.keuzeLeverancier.Column(varEmail)) Then
'Email adres naar klembord copieeren om beveiliging te omzeilen
Me.Klembord = Me.keuzeLeverancier.Column(varEmail)
varLengte = Len(Me.keuzeLeverancier.Column(varEmail))
Else
Me.Klembord = " "
varLengte = Len(" ")
End If
'Email adres naar klembord kopieeren
Me.Klembord.SetFocus
Me.Klembord.SelStart = 0
Me.Klembord.SelLength = varLengte
DoCmd.RunCommand acCmdCopy
Me.btnVersturen.SetFocus
'E-mail aanmaken
Set Outlook = CreateObject("Outlook.Application")
Set MyItem = Outlook.CreateItem(olMailItem)
'Set MyAttachments = MyItem.Attachments
MyItem.Subject = "Openstaande punten " & Format(Now(), "dd-mm-yy")
'Bericht instellen samen met handtekening
MyItem.HTMLBody = varbericht
'Bericht venster tonen
MyItem.Display
SendKeys "+{INSERT}"
Code for adding signature
Code:
Function EmailBericht(varbericht As String) As String
On Error GoTo EmailBericht_Err
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim Fs, f
Dim RTFBody As String
'File system object aanmaken
Set Fs = CreateObject("Scripting.FileSystemObject")
'Controleren of bestand is gevonden
If Fs.FileExists(CurrentProject.Path & "\Burando Martijn.HTM") = True Then
'Bestand inlezen
Set f = Fs.OpenTextFile(CurrentProject.Path & "\Burando Martijn.HTM", ForReading)
'Handtekening aanmaken
RTFBody = f.readall
'Object sluiten
f.Close
Else
MsgBox "Handtekeningen bestand is niet gevonden." & vbCr & _
"(" & CurrentProject.Path & "\Burando Martijn.htm)", vbExclamation, "Geen handtekening"
End If
'Bericht en handtekening samenvoegen
EmailBericht = varbericht & RTFBody
EmailBericht_Exit:
Set Fs = Nothing
Set f = Nothing
Exit Function
EmailBericht_Err:
MsgBox err.Description, vbCritical, "Probleem met toevoegen Handtekening"
Resume EmailBericht_Exit
End Function
Sorry for Dutch comment rows