Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

HTML Quote Marks in Outlook VBA

Posted on 2007-04-11
4
Medium Priority
?
349 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 400 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 600 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 400 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 600 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

670 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