Solved

HTML Quote Marks in Outlook VBA

Posted on 2007-04-11
4
346 Views
Last Modified: 2010-04-30
I am building an html email using Outlook VBA for the first time.
What is the appropriate way to handle quoting attributes in HTML?
I am finding that my quote marks are breaking the string.
My app works if I do not quote the attributes, but I want to know if that is the correct way to do it.

abbreviated Example (declare the body type)
 .HTMLBody = "<HTML><HEAD><title>Quote Letter</title></head>" & vbCrLf & _
"<body bgcolor="#aab5c0">" & vbCrLf & _
"<table width="650" border="0" align="center" class="contentborder">" & vbCrLf & _


so, the app will error out on bgcolor="#aab5c0"and all the attributes in the table-- "650" border="0" align="center" class="contentborder".


Are no quotes OK?
or should single quotes be used?

thanks
0
Comment
Question by:LT1415
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
Clif earned 100 total points
ID: 18892468
Personally I would use single quotes, for just the reason as you are running across.
0
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 150 total points
ID: 18892471
Triple them...

 .HTMLBody = "<HTML><HEAD><title>Quote Letter</title></head>" & vbCrLf & _
"<body bgcolor="""#aab5c0""">" & vbCrLf & _

0
 
LVL 10

Assisted Solution

by:Clif
Clif earned 100 total points
ID: 18892483
Oh, and some attributes will work without being wrapped in quotes, but it's best to be safe and wrap them all.
0
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 150 total points
ID: 18892494
Or use the character code...(which is what I usually use)...

 .HTMLBody = "<HTML><HEAD><title>Quote Letter</title></head>" & vbCrLf & _
"<body bgcolor=" & chr(34) & "#aab5c0" & chr(34) & ">" & vbCrLf & _
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question