'------------------------------------------------------
'How To: : Write quotation marks to a text file
'Posted: 07-July-98
'------------------------------------------------------
Q: I need to add a line similar to the following to a text
file using Visual Basic 5.0 and can`t get the quotation
marks to work.
set var b "george"
A: Try to join the string with the embedded "chr(34)" like so:
String = String & chr(34) & " Hello " & chr(34) & "!"
Print String
this would look like:
"Hello"!
A: As far as I know (and that`s not all that far), you cannot
include a quotation in a string by typing it in. VB, of course,
considers it to be one of the string`s delimiters. However, you
can include a Chr$(34), which is the ascii value for the quotation
mark. Better, you might add the quotes when you write the string
out to the file:
MyStr = "George"
Print #1, Chr$(34) & MyStr & Chr$(34)
Hth,
Bob Walsh
Downloads
In IE right-click and select 'Save Target As...' or in Netscape
right-click and select 'Save Link As...'
View Plain Text
Not Available
Not Available