I need to use HTML template file as body in emails. The emails will be sent via Outlook 2010. The code I made is working well with .oft files, but these files are being received as plain text, although they are sent as HTML and although they appear fine in sent box.
After googling, I found that for some reason Outlook 2010 cannot use .oft files properly. A lot of people have the same problem as me and no one offered solution so far.
Therefore, I must use HTML file instead of .oft file. Could you please help me change the code so it does everything the same, only uses external HTML file instead of external .oft file?
Additional, it would be quicker solution if you know how to send .oft file to be received as HTML and not plain text file. That is alternative, but I suspect it is not possible.
After googling, I found that for some reason Outlook 2010 cannot use .oft files properly. A lot of people have the same problem as me and no one offered solution so far.
Therefore, I must use HTML file instead of .oft file. Could you please help me change the code so it does everything the same, only uses external HTML file instead of external .oft file?
Additional, it would be quicker solution if you know how to send .oft file to be received as HTML and not plain text file. That is alternative, but I suspect it is not possible.
Code:
Private Sub dgmSlanje_Click()
Dim OutlookApp As outlook.Application
Dim Poruka As outlook.MailItem
Dim objDoc As Object
Dim OutlookRecip As String
Dim strCustomer As String
Dim strHTML As String
Dim Putanja As String
Set OutlookApp = CreateObject("Outlook.Application")
Putanja = ctrOft
Set Poruka = OutlookApp.CreateItemFromTemplate(ctrOft)
strCustomer = "'sandrini@neobee.net' (sandrini@neobee.net)"
strHTML = Replace(Poruka.HTMLBody, "%subfirstname%", strCustomer)
Poruka.Display
Poruka.BodyFormat = olFormatHTML
Set objDoc = Poruka.GetInspector.WordEditor
objDoc.Windows(1).Selection.Find.ClearFormatting
objDoc.Windows(1).Selection.Find.Execute strSender
'Poruka.DeferredDeliveryTime = #11/21/2011 10:15:00 PM# Odredjuje vreme slanja
If Not ctrPrima.Value = "" Then
Poruka.To = ctrPrima
End If
If Not ctrCc.Value = "" Then
Poruka.CC = ctrCc
End If
If Not ctrBcc.Value = "" Then
Poruka.BCC = ctrBcc
End If
If Not ctrTema.Value = "" Then
Poruka.Subject = ctrTema
End If
Poruka.SendUsingAccount = outlook.Application.Session.Accounts.Item(cmbEAdrese)
Set OutlookApp = Nothing
Set Poruka = Nothing
Set objDoc = Nothing
End Sub