Macro/Word converting double-quote marks into angle quotation marks

Hi all,

I've scripted a vba macro that opens html pages in txt format and adds
the following line after <BODY> (through a search and replace):

<link rel="stylesheet" type="text/css" href="Output.css" />

The problem I'm having is that Word or the macro (don't really know)
is converting the double-quote marks into angled quotation marks
(ASCII 147 and 148), which makes the line above unreadable by the
browser.

I've tried using Chr(34):
"<BODY><link rel=" & Chr(34) & "stylesheet" & Chr(34) & " type=" & Chr
(34) & "text/css" & Chr(34) & " href=" & Chr(34) & "Output.css" & Chr
(34) & " />"

But the browser still can't read it for some reason. I manually copied
the line from a working file, and they look exactly the same, except
that the copied line is recognized by the browser and the line added
by the macro is  not.

Any ideas?

Thanks
Carlos
0
supersub15
11/17/2009 5:39:30 PM
word.vba.general 1023 articles. 1 followers. Follow

3 Replies
1392 Views

Similar Articles

[PageSpeed] 56

Hi,

Word is doing this. You need to turn off replace straight quotes with smart 
quotes.

If you are using Word 2007, see 
http://office.microsoft.com/en-us/word/HP100822971033.aspx .

If you rae using an older version, see 
http://office.microsoft.com/en-us/word/hp051901241033.aspx .

-- 
Hope this helps,
Pesach Shelnitz 


"supersub15" wrote:

> Hi all,
> 
> I've scripted a vba macro that opens html pages in txt format and adds
> the following line after <BODY> (through a search and replace):
> 
> <link rel="stylesheet" type="text/css" href="Output.css" />
> 
> The problem I'm having is that Word or the macro (don't really know)
> is converting the double-quote marks into angled quotation marks
> (ASCII 147 and 148), which makes the line above unreadable by the
> browser.
> 
> I've tried using Chr(34):
> "<BODY><link rel=" & Chr(34) & "stylesheet" & Chr(34) & " type=" & Chr
> (34) & "text/css" & Chr(34) & " href=" & Chr(34) & "Output.css" & Chr
> (34) & " />"
> 
> But the browser still can't read it for some reason. I manually copied
> the line from a working file, and they look exactly the same, except
> that the copied line is recognized by the browser and the line added
> by the macro is  not.
> 
> Any ideas?
> 
> Thanks
> Carlos
> .
> 
0
Utf
11/17/2009 6:40:07 PM
That was easy. Thanks.
0
supersub15
11/17/2009 7:03:13 PM
Hi Carlos,

It would be better to avoid the whole issue by never getting the ASCII
147 and 148 quotes in the first place. They're inserted by the
'"Straight quotes" with "smart quotes"' option under Tools >
AutoCorrect Options > AutoFormat As You Type. On any particular
instance of Word that option may be on or off, so your problem may
appear for some users and not others.

To work around it, in your macro that adds the stylesheet link, do
this:

   Dim userSmartQutes As Boolean
   userSmartQuotes = Options.AutoFormatAsYouTypeReplaceQuotes
   Options.AutoFormatAsYouTypeReplaceQuotes = False

   ' do your work here -- all will be straight quotes (Chr(34))

   ' restore user's setting
   Options.AutoFormatAsYouTypeReplaceQuotes = userSmartQuotes

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.


On Tue, 17 Nov 2009 09:39:30 -0800 (PST), supersub15
<carlos_chalhoub@hotmail.com> wrote:

>Hi all,
>
>I've scripted a vba macro that opens html pages in txt format and adds
>the following line after <BODY> (through a search and replace):
>
><link rel="stylesheet" type="text/css" href="Output.css" />
>
>The problem I'm having is that Word or the macro (don't really know)
>is converting the double-quote marks into angled quotation marks
>(ASCII 147 and 148), which makes the line above unreadable by the
>browser.
>
>I've tried using Chr(34):
>"<BODY><link rel=" & Chr(34) & "stylesheet" & Chr(34) & " type=" & Chr
>(34) & "text/css" & Chr(34) & " href=" & Chr(34) & "Output.css" & Chr
>(34) & " />"
>
>But the browser still can't read it for some reason. I manually copied
>the line from a working file, and they look exactly the same, except
>that the copied line is recognized by the browser and the line added
>by the macro is  not.
>
>Any ideas?
>
>Thanks
>Carlos
0
Jay
11/17/2009 8:00:30 PM
Reply:

Similar Artilces:

Create a status designation from 5 date fields using "Not IsNull"
I am still learning, lots that I don't know, but I am trying to create a status designation from 5 date fields using "Not IsNull" and having difficulty. I am not sure if this will fuction best in query, forms... can I do this on the table??? After some research, this is what I have in a query for now and it seems to work but I don't want a number: Status: IIf(Not IsNull([cogradulate]),5,IIf(Not IsNull([verifydate]),4,IIf(Not IsNull([permCAdate]),3,IIf(Not IsNull([shorttermCAdate]),2,IIf(Not IsNull([containmentdate]),1,0))))) When I change it to a word in...

Word Quits when I close document window
I'm running Office:mac X on OS 10.1.5. When I close a window in word, it usually quits with an error message that says it quit unexpectedly and that other applications and the system are not affected. This also happened when I was running Word for Mac '98 on Classic 9.2.2, but not as consistently. Does anyone know what is going on and how to fix it? In article <0aef01c3789d$3d5f4c00$a001280a@phx.gbl>, "Liz" <S0journer@aol.com> wrote: > I'm running Office:mac X on OS 10.1.5. When I close a > window in word, it usually quits with an error message th...

Macro warning with no macros
I have a workbook that when I try to open it I get the warning tellin me it contains macros and asking whether I want to Enable or Disabl them. I put no macros, no VB scripts, nothing at all in the workboo other than standard Excel formulas and some charts. I developed it i Excel 2002, SP-2, but have moved it back and forth between tw computers, the other which has Excel 97. Regardless of whether Enable or Disable or change the security settings so as not to get th warning, once the workbook is open even if I go t Tools-Macro-Macros... it lists no macros. How can I find out what's cau...

Hyperlink to a bookmark created in Word and copied to Windows Mail don't work
A bookmark created in Windows Mail along with the hyperlink to it don't work when copied to Windows Mail for e-mailing I get an error message: mid://00000174/ ...

Where do I find "save as..." in MS Office 2007 ?
Sorry, but I did not found "save as..." menu in Office 2007. I only found in the upper left corner a flopy icon which represent a "save" but not a "save as...." So where is "save as..." (with files selction dialog) hidden in Office 2007? Camille Click the Office button (the round "pizza icon" in the upper left corner of the screen) and then click Save As. -- Stefan Blom Microsoft Word MVP "Camille Petersen" <cpet_magnus@hotmail.com> wrote in message news:4baf94cc$0$6768$9b4e6d93@newsspool3.arcor-onlin...

Macro
Can anybody tell me how to kick off a macro automatically as file is opened? Regards ...

Convert old PPT file
My company recently upgrade the office 2003 to office 2007. It works well for most of the users except one. He had thousands of old powerpoint slides which created around year 1996,1997. By using right click to check the file properties, it shows the the application name is 'Microsoft Powerpoint 4.0' .These file can be opened by powerpoint 2003 but can not being opened by powerpoint 2007. Does anyone have idea how I can bulk convert those files to powerpoint 2003 format? Thanks James Steve has a macro here http://www.pptfaq.com/FAQ00740.htm -- john ATSIGN PPTAl...

Why do legacy checkboxes freeze text fields in Word 2007?
If you use "Legacy Controls" checkboxes in Word 2007 and you have plain text or rich text fields, when you protect the document it will freeze you out of text fields after you select a checkbox. It only seems to do this with more than four or five check boxes and more than four or five text boxes. Help, anyone? Legacy fields require the document to be protected. Word 2007 content controls require it to be unprotected, thus the two are incompatible in the same document. -- <>>< ><<> ><<> <>>< ><<> <>...

Word uses up a lot of memory
When I open a file of Word97-03, it uses up a lot of memory. eg. My RAM is 4GB and it uses up 1,002,188K for WINWORD.EXE Sorry, but this newsgroup is for questions about Access, the database product that's part of Office Professional. You'd be best off reposting your question to a newsgroup related to Word. Should you do that, it might help the responder to know more about your setup. What version of Word are you using? What Operating System? What else is running at the same time and so on. Good luck! -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele...

Converting minutes to seconds #6
Frank Kabel Wrote: > Hi > what does not work for you in the solutions offered to you? > =MID(M5,1,2)*60 + MID(M5,3,2) Aladin Akyurek Wrote: > =("0:"&SUBSTITUTE(A1,".",":"))*86400 Thanks that works great : -- smith.james ----------------------------------------------------------------------- smith.james0's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1623 View this thread: http://www.excelforum.com/showthread.php?threadid=27641 ...

Macro
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: intel Hi, I'm thinking of buying Mac: Office 2008, but before I do I want to check that I will be able to download Scritpsmart collection of templates without any glitches: <http://www.bbc.co.uk/writersroom/scriptsmart/faq.shtml> Does anyone know if I can do this? Regards, SP. In article <ee98ff5.-1@webcrossing.caR9absDaxw>, StregaItalia@officeformac.com wrote: > Version: 2008 > Operating System: Mac OS X 10.4 (Tiger) > Processor: intel > > Hi, > > I'm thinking of buying Mac: Of...

I keep having to force quit MS Word It also Freezes screen often
Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I keep having to force quit MS Word. It won't quit when I hit quit. It also seems to Freeze the screen often and I have to restart. Help? Without having so much as an indication what version of Office you're using it's impossible to suggest anything other than the fundamentals; 1- Make sure your version of Office is fully updated, 2- Make sure OS X is fully updated, 3- Run Disk Utility - Repair Disk Permissions, 4- Restart your Mac. If you continue to have a problem reply here with version specific in...

Attached Toolbars Macros
Excel 2003 I have a custom tool bar, this tool bar has several items, each item is pointing to a VBA code. This tool bar is attached to the worksheet. I've copied this spreadsheet to several computers. After I copied the spreadsheet I decided to rename the spreadsheet, after I renamed the spreadsheet the Toolbar Item's macros were still pointing to the old name, I reasigned each tool bar item to the current spreadsheet, saved the spreadsheet and everything was working on my computer, but when I re-copied the new spreadsheet to other computers and I clicked on the Toolbar Item...

Run macro automatically.
How do I make a macro run automatically when a worksheet it is attached to is loaded? right click on the sheet tab>view code>left window worksheet>right window activate -- Don Guillett SalesAid Software donaldb@281.com "Excel macro" <Excel macro@discussions.microsoft.com> wrote in message news:DD7AF1E3-9263-4523-AC49-A43ABA1AB9D0@microsoft.com... > How do I make a macro run automatically when a worksheet it is attached to is > loaded? I am unable to find "activate " when I right click on worksheet. ( i assume that you are referring to the windo...

Quote Number
I would like for users to go into a form and reserve a quote number. Would like the quote number to be auto-assigned using mmddyy (then count 01 to xx for the day) followed by their initials. Basically result would be 02280801TR for the first then 02280802TR etc....Not mandatory for the Initials if you could solve the autonumber mixed date field...Initials could be another field in the database and could combine later. Thanks Tony, I would place the below on the AddNew button: DoCmd.GoToRecord , , acNewRec Me.txtQuoteID = StrReverse(Format(Date, "mm")) & Format(Date, &quo...

Help with macro/and or formula?
Perhaps this is a silly question, but i just can't figure out how t format this worksheet. The problem is that a lot of the cells hav numbers in them with negative signs in the back instead of in the fron (ie. 23-) and i was wondering if anyone knew of a macro/formula i coul use to quickly fix this problem for all the cells. I would b extremely grateful. Thanks -- brefed1 ----------------------------------------------------------------------- brefed15's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3557 View this thread: http://www.excelforum.com/showthre...

single quotes issue
Hi, I am passing comma separated values to a stored proc within which that value is used something like this. select col1, col2 from tablename where col3 in (select * from FnStringSplitter(@strParam, ',')) it works fine as long as one of the string has a single quotes in it. I tried like select col1, col2 from tablename where col3 in (select * from FnStringSplitter(Replace(@strParam,'''',''), ',')) still the data doesn't show up. Any idea what i need to change in the query. Regards Pradeep The problem is in your function...

Copy picture from word 2003 to word 2007
When I copy a document with a picture from 2003 to 2007 the picture ends up with what looks like a bunch of lines - horizontal. Any way to get rid of this? Your best bet would be to right click the picture in your 2003 document and save the picture to your computer. After this is completed, open Word 2007 and click insert picture. Now browse your computer and find that picture you saved. I'm surprised this happened, but I'm guessing its a compatibility issue between 2003 and 2007. "Daisy" wrote: > When I copy a document with a picture from 2003 to 2007...

"Action canceled" message when clicking on a link in HTML email
Hi, I have the following link in a HTML file that exists on my disk: <html> <body> <a href="http://someurl.com/some/DocumentDownload?doc=66">Document</a> </body> </html> Clicking on the Document link opens a Word Document just like you'd expect - nothing unusual. However, If I email this same HTML and click on the link in Microsoft Outlook the Word document opens, but an Internet Explorer window opens having the message: Action canceled Internet Explorer was unable to link to the Web page you requested. The page might be temporarily una...

Protected sheets and running macros
i have a sheet with a macro ran by a normal button at the top. Howeve when i protect the worksheet where ever i click on the sheet the macr executes. Can any one offer any advice on how to stop this? Thanks Robert -- Message posted from http://www.ExcelForum.com hi, i am not able to reproduce the problem, hence i may not be able t provide a panacea for that issue. here is what i suggest. i have a sheet that has a macro that is run when a control toolbo button (that is, not a form button) is clicked. this sheet is protected based on the user logged in. what i have don is to protect t...

Macro Freezes Reading Pane
I have a macro that Sends/Receives Tasks from Project Server into Outlook Tasks. Everything is working fine, except one weird thing that happens. I have the Timer set on the macro and it starts as soon as Outlook starts. The macro gets the tasks from ProjectServer every hour. As soon as the macro starts running the Reading pane freezes in the Inbox. If i stop the macro then Reading pane is back to normal. Can anyone please tell me if there is something I can do in VBA to fix this annoying issue. Thanks a lot ...

Macro to remove rows?
Hi, I receive thousands of rows of data from an extract that comes from a database. The data extract automatically generates page headers that need to be removed, and I would love to automate this process. The headers do have a pattern to them, but I'm not clever enough to figure out a good way to use that to write a macro. The first row of the header starts with hyphens ------------------------------- Then there's a variable number of rows of header data to delete followed by another row of hyphens ------------------------------- Then 2 additional rows that must be deleted. The nu...

what does "no more new fonts may be added to this workbook" mean?
I get this message dialog box when I try to change the source data in an excel file chart. However, I don't undertand why it occrus. My intention is not to add any "font" data but just to change the source data reference of the chart. does anyone know WTF is up here?! http://peltiertech.com/Excel/Charts/FixFonts.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "NaridaRovi" <NaridaRovi@discussions.microsoft.com> wrote in message news:0B50E2E3-A661-4FA1-B604-3...

Where are the collums in Mircosoft Word?
PLEASE ANSWER A.S.A.P.!!! Assuming that you are referring to newspaper columns and that you are using Word 2007, look at the Page Layout tab. You'll find a Columns command in the Page Setup group. -- Stefan Blom Microsoft Word MVP "Kaitlyn Moreland" <Kaitlyn Moreland@discussions.microsoft.com> wrote in message news:1D282483-D7F6-440C-AEDA-132789AED1BA@microsoft.com... > PLEASE ANSWER A.S.A.P.!!! WORD 2007 Page Layout / Page Setup group / Columns Please hit Yes if my comments have helped. Thanks. "Kaitlyn Moreland" wrote: ...

Send Quote via Email
I have created a quote and would like to send it via email Is this possible without getting too technical! Hi Andrew, (1) In Outlook client using Mail Merge * Open the quote * File-->Format for Customer * Walk through the mail merge steps using "quote.dot" template This template could potentially be modified for more/less data. (2) Download the sample quote report by EdMar from CRM Sandbox The rdl file is at http://codegallery.gotdotnet.com/crm under the Downloads section with title "Quote Sample Report". Download this file and import it to your reports s...