Solved

HTML Quote Marks in Outlook VBA

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

If you don't know how to downgrade, my instructions below should be helpful.
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 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