View Single Post
  #6 (permalink)  
Old April 14th, 2009, 04:32 PM
philip_cole philip_cole is offline
Friend of Wrox
 
Join Date: Sep 2005
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts
Default

Myer,

It is the actual syntax of your code which is causing the error. Vadivel is correct in that the actual string you are putting in the code should have double quotes escaped as two double quotes. Putting 2 double quotes in does not mean that the value of the variable now contains 2 double quotes - it tells the vbscript parser to treat them as being 1 double quote character within the string.
So if you want the double quote to be in the string of your original code, you must escape it as so:
vb Code:
Dim strMyVariable
strMyVariable = "NEW Craftsman Microtork 3/8"" Torque Wrench"
strMyVariable = Replace(strMyVariable, Chr(34), Chr(39))
MsgBox "Output ::  " & Trim(strMyVariable)

This will show the output with just a single quote:
NEW Craftsman Microtork 3/8' Torque Wrench

Phil

P.S. @Sandeep, I assume you are referring to the PHP heredoc syntax where you can spread string variables over multiple lines. This isn't available in vbscript.

Last edited by philip_cole; April 14th, 2009 at 04:35 PM..
Reply With Quote