Solved

HTML Quote Marks in Outlook VBA

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
Get an idea of what you should include in an email disclaimer with these Top 5 email disclaimer tips.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
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: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now