Solved

HTML Quote Marks in Outlook VBA

Posted on 2007-04-11
4
345 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

751 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