473,586 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

One outlook email not displaying HTML formatted message?

2 New Member
XP SP2, access and outlook 2003

I have a form with 3 command buttons on that when one is pressed it opens up a html email for the user to send. Two of the emails work fine and open with the full colour and size formatted text but one of them just shows the html code in the body with no formatting.

The vba code for the command button is as follows:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdUpdateEmail_Click() 
  2. Dim HTMLReminderEmail As String 
  3. Dim Subject As String 
  4. Dim objOutlook As Outlook.Application 
  5. Dim objOutlookMsg As Outlook.MailItem 
  6. Dim RefNo As Integer 
  7.  
  8. Set conn = New ADODB.Connection
  9.  ' Specify the OLE DB provider. 
  10. conn.Provider = "sqloledb" 
  11.  
  12. ' Set SQLOLEDB connection properties. 
  13. conn.Properties("Data Source").Value = "PPE-DB2" 
  14. conn.Properties("Initial Catalog").Value = "Live_Service" 
  15.  
  16. 'Windows NT authentication. 
  17. conn.Properties("Integrated Security").Value = "SSPI" 
  18.  
  19. ' Open the database. 
  20. conn.Open 
  21.  
  22. RefNo = Me.txtRefNo 
  23. Set rs1M = New ADODB.Recordset 
  24. rs1M.Open "Select * from _1MIncidents WHERE [RefNo] = " & RefNo, conn, adOpenDynamic, adLockOptimistic 
  25. 'Create the application 
  26. Set objOutlook = CreateObject("Outlook.Application") 
  27. Create the mail item 
  28. Set objOutlookMsg = objOutlook.CreateItem(olMailItem) 
  29.  
  30. 'HTMLReminderEmail = "<HTML><Font Face = " & Chr(34) & "Arial" & Chr(34) & "><Font color = " & Chr(34) & "Blue" & Chr(34) & "><Font Size = " & Chr(34) & "3" & Chr(34) & ">All,<br><br>The problem has been identified,</font color></font size><font color = " & Chr(34) & "Red" & Chr(34) & "><Font Size = " & Chr(34) & "4" & Chr(34) & ">Please do not attempt to use " & rs1M![systemArea] & " until further notice.<br><br></font color></font size><Font color = " & Chr(34) & "Blue" & Chr(34) & "><Font Size = " & Chr(34) & "3" & Chr(34) & ">The Business Systems Team are working to return normal service ASAP.</Font Size></Font Color></Font></HTML>" 'HTMLReminderEmail = "<HTML><body><font face = " & Chr(34) & "Arial" & Chr(34) & "><font size = " & Chr(34) & "2" & Chr(34) & "><font color = " & Chr(34) & "Blue" & Chr(34) & ">All, <br><br>The Problem has been identified, </font color></font size><font size = " & Chr(34) & "3" & Chr(34) & "><font color = " & Chr(34) & "Red" & Chr(34) & ">Please do not attempt to use " & rs1M![systemArea] & " until further notice.<br><br></font color></font size><font size = " & Chr(34) & "2" & Chr(34) & "><font color = " & Chr(34) & "Blue" & Chr(34) & ">The Business Systems Team are working to return normal service ASAP.</font color></font size></font face></font></body></HTML>" 'MsgBox HTMLReminderEmail HTMLReminderEmail = "<HTML><Font Face = " & Chr(34) & "Arial" & Chr(34) & "><Font color = " & Chr(34) & "Blue" & Chr(34) & "><Font Size = " & Chr(34) & "3" & Chr(34) & ">All,<br><br>The problem has been identified,<font color = " & Chr(34) & "Red" & Chr(34) & "><Font Size = " & Chr(34) & "4" & Chr(34) & ">Please do not attempt to use " & rs1M![systemArea] & " until further notice.<br><br></font color></font size>The Business Systems Team are working to return normal service ASAP.</Font Size></Font Color></Font></HTML>" 
  31.  
  32. Subject = rs1M![systemArea] & " Error" 
  33.  
  34. With objOutlookMsg 
  35.     .To = "Matthew.Bradshaw@prepol.com" 
  36.     .Subject = Subject 
  37.     .body = HTMLReminderEmail 
  38.     .BodyFormat = olFormatHTML 
  39.     .Display 
  40. End With rs1M![LastEmailed] = DateTime.Now rs1M.Update
The html code produced is

"<HTML><Fon t Face = "Arial"><Fo nt color = "Blue"><Fon t Size = "3">All,<br><br >The problem has been identified,<fon t color = "Red"><Font Size = "4">Please do not attempt to use Syteline until further notice.<br><br> </font color></font size>The Business Systems Team are working to return normal service ASAP.</Font Size></Font Color></Font></HTML>"

When the html is put in a notepad file and saved as a html document it displays correctly, but for some reason outlook is not picking up the html for this email.

Thanks in advance Matt
Sep 4 '08 #1
1 4576
robnoper
2 New Member
Never mind just realised in the objoutlookmessa ge with should e .htmlbody not .body.

Spent about 2 hours trying to get this to work.
Sep 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
12067
by: Google Mike | last post by:
I've got RH9 Linux with default PHP. Is there a way to send email on Linux to an Exchange Server from PHP and/or other tools when there is *NOT* SMTP access? Has anyone figured out a way to use PHP to get inside an OWA (Microsoft Outlook Web Access) website to send email that way? The reason I ask is because my corporate office is going...
1
8483
by: Deepak Bhatia | last post by:
Hello Friends I wrote a simple VB application using Outlook Object Model. This application is used t send mail via MS Outlook. I wrote following code on Send button: Set mailitem = obj.CreateItem(olMailItem) Set objname = obj.GetNamespace("MAPI") mailitem.To = "dbhatia@pscindia.com" mailitem.Body = RichTextBox1.TextRTF
4
3438
by: Fred | last post by:
I want to insert DHL and FedEx tracking links with the waybill numbers in the body of emails I am sending using sendobject. I am not sending attachments. DHL and FedEx use long links that truncate in plain text format. How do I send an html formatted body in sendobject? Or does DHL and FedEx have a shorter link? Thanks.
2
6103
by: Eric Peterson | last post by:
I need to pop up the send email form from Outlook. I also need to populate the to field, but obviously the user will type the message and hit 'SEND'. How can I do this? I've been through various examples, and they're all about automating email within vb, I only want to automate 1/2 the process. Thanks for help. Eric
10
2832
by: John | last post by:
Hi When I open a new outlook email from vb.net, sometimes outlook is very slow to appear or occasionally outlook freezes completely. I am targeting mixed office2000/xp environments so I am using the office2000 interop dlls generated by vs.net by adding office 2000 com reference. Any one else noticed this problem when targeting...
2
14370
by: Siv | last post by:
Hi, I have written an application which is used by sales staff when discussing products with their customers over the phone. It is a database application that holds detailed information about their products including pictures to assist the sales staff describe features to the customer. The next step in development of the app is to have a...
6
3676
by: windandwaves | last post by:
Hi Folk Some of my clients asked me to create "fancy emails" for them (aka html formatted emails). I know how to make a nice html document, but I had trouble creating a simple way to provide the document to my clients so that they could use it to. I know most of them use Outlook XP or Outlook 2003, so what I created was a page that...
3
2828
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and additionally pictures of the product are stored in an images subfolder and the database holds the file name of the relevant picture. The user can then click a...
0
1359
by: mrajeshbabu | last post by:
hi this is Rajesh i am working with email concept in asp.net 2.0 i am using html formatted email and i have put in table control all the images and text
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8204
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.