Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Eliminate Quotation Marks From Excel Vba Generated Text?

Looking for assistance on how to eliminate quotation marks from
Excel vbe generated text output - here is an example: when I run
the below code and the text file is generated it has opening and
closing quotation marks '"' and I was wondering if there is a
way to stop them from being generated as they are not
wanted/desired in the output. Thanks in advance for your
assistance in this matter.

Range("B1").Offset(Count + 1, 4) = _
Range("B1").Offset(Count + 1, 15) & vbCr & _
Range("B1").Offset(Count + 1, 16) & vbCr & _
Range("B1").Offset(Count + 1, 17) & vbCr & _
Range("B1").Offset(Count + 1, 18) & vbCr & _
Range("B1").Offset(Count + 1, 19) & vbCr & _
Range("B1").Offset(Count + 1, 20) & vbCr & _
Range("B1").Offset(Count + 1, 21) & _
Range("B1").Offset(Count + 1, 9) & _
" Mover Down:" & _
" net change of " _
& Format(Range("B1").Offset(Count + 1, 3),
"0.00%") & "@<" & vbCr & _
Range("B1").Offset(Count + 1, 22) & _
Range("B1").Offset(Count + 1, 9) & _
" " & _
Range("B1").Offset(Count + 1, 23) & _
" : " & _
"Mover Down:" & Format(Range("B1").Offset(Count +
1, 3), "0.00") & _
" net change of " _
& Format(Range("B1").Offset(Count + 1, 3),

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Save Excel-sheet As Text Without Double-quotation Marks
Hi all,

I have a specific problem in regards to saving a excel-sheet in text (notepad). Several of my rows contain data including comma (which have to be there), when I save the file as normal text the double quotation mark (") appears at the beginning and end of that row.

I was able to save the entire sheet as a .prn file using:
Worksheets("Header").SaveAs Filename:Test _FileFormat:=xlTextPrinter

and the (") disappeared, however this format only allows 240 characters in each line of notepad, I need much more than that on each line.

So basically if there is a solution to either one of them I would be extremely happy.


Writing Text Without Quotation Marks
I would like to write text to a file and have it appear without quotation marks. Right now I'm using the Write # method and all text I write is surrounded by quotes. Any advice?

Quotation Marks In Text File.
When I output my file, it is placing quotation marks at the beginning, and end of the file. Any ideas???
I have attached a sample.
I need to remove them, my machines, can't read them, and our DNC software, also has a problem with them.

Concatenating Quotation Marks Into A Text File
Hello everyone,
I am a relative newbie to VB (been working at it for the last few months).
I am working with VB 6 Professional. I have come across a problem that I
need help with.

I am looking to append text to an empty text file in a particular format.
Data is gathered from a csv sequential file I am reading from.

I would like the output to look like this:

OBJECT TYPE= "contact",NAME=contact_123456789
UNIQUE_FIELD = first_name, last_name, phone

Everything above is text except for the 123456789 and JOHN which are
sequential file fields.

The code I have written is this...

report = "OBJECT TYPE=" & Chr(34) & "contact" & Chr(34) & ",NAME=contact_" &
strUIN & vbCrLf _
& "UNIQUE_FIELD = first_name, last_name, phone" & vbCrLf _
& "FIELDS" & vbCrLf _
& "first_name=" & Chr(34) & strFirstName & Chr(34) & ";" & vbCrLf _

report is a string variable used to collect the report. strUIN is the field
name that produces 123456789. strFirstName is the field name for the first
name - JOHN. Chr(34) is the decimal converter function to get " in my text.

When I write the variable to a textbox I get this as an output....

OBJECT TYPE="contact",NAME=contact_123456789
UNIQUE_FIELD = first_name, last_name, phone

This is exactly what I need.

But when I write this directly to a text file I get this as an output....
even if I write it to the textbox and then take the textbox contents and
write them to the file.

"OBJECT TYPE=""contact"",NAME=contact_650012345
UNIQUE_FIELD = first_name, last_name, phone

As you can see my output to my text file has a few problems.
I get a leading single quotation mark, and then double quotes around the
work contact followed by double quotes around john. I need the quotes but
only one set so instead of ""JOHN"" I need "JOHN". I don't get these
problems when I write to a text file.

Can any one help me with this problem? I am under the gun to figure this

Thank you so much in advance.

John Cowsert

Saving To Text File - Without The Quotation Marks
I am writing to a text file, but I don't want the string to be enclosed in quotation marks when I view the file.

Is there any way of saving the file without these quotation marks?

I seem to remember something about using something other than "Write", but I can't remember what!


My Code:

Code:Open App.Path & "PreviousRecords.txt" For Append As #Filenum
    If Len(App.Path & "PreviousRecords.txt") = 0 Then
        Write #Filenum, "Draw Date is " & dtp1.Value & vbCrLf & vbCrLf
        Write #Filenum, vbCrLf & "Draw Date is " & dtp1.Value & vbCrLf & vbCrLf
    End If
Close #Filenum

Edited by - andy99 on 2/27/2004 7:21:02 AM

Urgent!!! Quotation Marks Within Quotation Marks
Can someone please tell me how to get around using quotes inside of a string e.g.

RemapCode$ = RemapCode$ & " <bind action = "use_item" key1 = "key_mouse1" key2 = ""/> "

I don't have the option of removing the quotes inside the string, they must be there.

Any help will be appreciated.

Quotation Marks?
why does my text writer store quotation marks when i save a file?

if i type and save

bla bla bla

in it, when i open the file in notepad, it says

"bla bla bla"

is there any way to get rid of it?

Quotation Marks
When I write text to a file, quotation marks are added to
each line. How can I get rid of them?

Different Quotation Marks In VB6
lately i've noticed
2 different types of Quotation Marks
in .TXT Files Emailed to me.

one is ordinary " CHR$(34)

the other is

what is the VB6 Character Code to create instead of "

Quotation Marks?
I have a program which simply reads a txt file and then prints selective information into a new txt file.

The line which says what to print to the new file basically starts with an IF command....


I need to be able to get the IF command to search for a string inside quotation marks , similar to ...

if XXXXXXXX = " "ABCDEFGH" " then

The reason for this is that the string may appear in several lines , but I only want to copy the line where the string appears in the quotation marks.

Is this possible?

Hope that makes sense.
Thanks in advance.

Getting Rid Of Quotation Marks
suppose i have string that generates a value
how do i get rid of the quotation marks so i have

Quotation Marks
when writing to a file i need to put qoutation dont work?why?how do I fix this?please help!

?-=The Bomb=-?
"You all stare, but you'll never see; theres something inside me!"

How Do You Get Rid Of Those Quotation Marks When W
How do you get rid of those quotation marks when writing text to a txt file....?
I want to keep records of Ip addresses
transfering data from a textbox to a [.TXT] file and vise versa.
I know about append but i usually get Input + Output mixed up....
Any help would be apreciated...


?-=The Bomb=-?
"You all stare, but you'll never see; theres something inside me!"

Getting Rid Of Quotation Marks
Lets say I get a string returned to my variable that has quotation marks around it, is there a vb function that can get rid of them?

say i get this:
from input i get "dsdfdf"
variable = ""dsdfdf""

how can i get variable to be equal to:

variable = "dsdfdf"

Quotation Marks In Sql???
How do I allow for quotation marks in a text field (or any other control for that matter)? currently i'm using the following sql to call records from an access database into my app: -

"WHERE addresses.address_type LIKE """ & lstAllAddresses.Text & """;"

the lstbox is populated from the same database, but if a record is added which contains double quotes in the field I get an error. If anyone can offer a simple explanation on how to deal with quotes i'd be extremely grateful.


Quotation Marks
Hi guys!

I need to have following shell execution from within a vb6 program:

C: est est.exe service /install VBSTRING "/username:domainuser" /password:test

So the code for that would look something like this:

Private Sub Command1_Click()
dim host as string
Shell "C: est est.exe service /install /server:" & VBSTRING & "/username:domainuser /password:test"
End Sub

The problem whit this seems to be that i cant set the /username:domainuser part between "", how do i do this?

Thanks in advance guys!


Quotation Marks
Hi everybody!!!
I need some help.
I have to write the quotation mark character in a variable.
For example, the variable value is: hello"world
How can I do that?


No Quotation Marks In Output?
Is there a way to get rid of the quotation marks around the text in a file?
I.E: I'm putting a VBScript interpreter into one of my programs, but when it saves a script, it saves the script with quotation marks around it. Is there either, some way to get rid of them when saving, or is there some way to get rid of them when loading the script?

How Do You Put Quotation Marks Using Vb Code?
My attempts to put quotation marks into a text box or rich text box failed.

Private Sub Command1_Click()
Label1.caption = """ 'This does not work!
End Sub
Any suggestions??

How To Remove Quotation Marks
I was wondering when I write strings to files how can I make the quotation marks not appear in the file, for example if I write a string to a file names z.txt and open it up it will have quotation marks before the text and after, so how can I remove this in visual basic when I write a file?

Quotation Marks Problem
Hello. I have this problem. I am programming this email program that uses the command line and visual basic scripts. When i try to put this command in my code shell "echo Set OutlookApp = CreateObject("Outlook.Application")>file.vbs" then i get error saying expected end of statement. The problem seems to be in those quotation marks. Does someone know how to fix this error? Thank you in advance!

Using Quotation Marks In A String
Is it possible to use quotation marks in a string? Is there some sort of variable that I can use like vbQuote or something because it won't work if you just use:
VB Code:
Call MsgBox("John Shouts "Hello"")

Removing Quotation

I was thinking about : how to remove quotation marks from the following string using VB :


I want to remove the first quotation and the last one..

Thanks in advance!

Quotation Marks Are A Pain Is The Azz.
At least I think they are. I found out that if you want a variable to be a double quotation mark then you have to do X = """" which doesn't make much sense but anyway. I've got a file that has nothing but a double quotation mark in it. I open the file for input as #1 and say "Input #1, X" When I say MsgBox X, though, it is blank. Does anyone know how to make it recognize quotation marks? Any tips or tricks I need to know about them in general?

Remove Quotation Marks???

Does anyone know how to remove the "" when you wirte data to a flat file. Help Please!!!!


Help! Stirng IO W/out Quotation Marks
Hi there. I'm trying to put together a quick VB6 program to do some parsing and write out an XML file. I've been using the Write# method to output data to the file, but unfortunately this puts quotation marks around all my strings. XML, being rather particular about the placement of quotation marks, frowns upon this. Is there a simple method for writing a string out to a text file without having the quotes automatically inserted? Thanks.

Nesting Quotation Marks - Help Please
I need to assign a string to a variable but the text string includes quotation marks:

Example: MyString = "He turned and said "Hello" before leaving."

When the compiler hits the quotation marks in front of Hello, it assumes the string is over and generates and error on the remainder. I must use the double quotes " in my string and not the single ' so that isn't an option.

How can I avoid this?

Thanks in advance from a noob thrasher!


Quotation Marks In A String
How do i insert Quotation marks into a string so that when the string is displayed it shows:
Jon said "I am cool."

Please do not reply with answers such as use two of these '

SQL Statement And Quotation Marks
I have a database which I need to pull info from via VB6. My sql statement looks like this: strSql = "SELECT [KeyContact],[CustFax],[CustName] FROM [Customer] WHERE CustName = '" & cboDistributor & "'"

My problem is that cboDistributor can contain names with quotation marks, ex: Jim's Company. This then casues an error.

I can't change the names in cboDistributor (take the quotes out).

Any suggestions?

Ignore Quotation Marks
Dim B as string
//things in here
Write #1, B

when it writes it, it adds quotation marks. it is like:
How to suppress the quotations marks. to be like:

Quotation Marks In A String
I know this seems a silly question, but I only do VB programming once or twice a year:
In VBScript, I need to have strings that contain quotation marks.

I guess it can be done somehow like this:
Dim temp
temp = "I want " & Chr(something) & " quotations"

Q1: What's the value of 'something' in this
Q2: Is there any other way to do this?

Any suggestions appreciated.

Remove Quotation Marks From Txt File
I am wanting to append a text file, and remove all the Quotation marks ( " ), from it. I have tried using Replace, But it doesnt work, it gets confused because i am replacing """ , if you get me. since there are 3 ", it thinks that the second one is the closing one and thinks the third one is starting another set.

Any help much appreciated.

Eliminating The Quotation Marks In A Textfile
I have an application that writes information from my application program to a textfile. The user needs to be able to print the info in the text file whenever someone requests a copy. My problem is that there are quotations that are placed in the textfile automatically and i dont want the user to have to open the textfile and delete the quotations everytime she has to print the contents of the text file. How can i get rid of them.

Why Vb Crashes With Single Quotation Marks
Some time ago, i went to this forum to ask how to identify single quotation marks inside a sqlserver databases. I did that because my app was crashing when find a string with single quotation mark in the recordset. I initially solve the problem erasing the single quotation marks from the strings, but now they are really necessary, like to identify monitor inches (15',17') . How can i avoid this problem ? I'm acessing sqlserver 2000 (sp2) via ado code ,and in vb i have vb 6.0 (sp5).
Thanks for helping !

Quotation Marks In Textfile Won't Delete!
Hey everyone!

I hope this is a simple question.... If not, I appologize! I'm using this code to write variable opt to an HTM file (in C:):

VB Code:
Open "C:citations.htm" For Output As #1Write #1, optClose #1

opt has been pre-formatted as an HTM file (e.g. <html><head>.....</body></html>), and all quotation marks have been removed; in fact, just before opt is written to a file, it is processed using this code:

VB Code:
opt = Replace(txtCode.Text, Chr(34), "")

For some reason, when I view the website it generates, it always has a quotation mark at the beginning and end. Correct me if I'm wrong, but I would think not including any quotation marks in the variable should negate them from appearing, no? Or, am I making a stupid mistake, like deleting the wrong character?


Adding Quotation Marks Around A String
How Do you add quotation Marks around a string?

VB Code:
Winsock1.Send strMessage

How can I put strMessage in quotations?

What's The Easiest Way To Display Quotation Marks?
Hello, I'm Captain Beginner in that I have no idea what I'm doing.

I was trying to put together a little program and part of it required adding quotation marks to something and then displaying that in a text field.
This is an example of how I've been doing it, but I have a feeling there must be an easier way:

Private Sub cmdExpedite_Click()
Dim Qmark As String, QmarkU As Integer
QmarkU = 34
Qmark = ChrW(QmarkU)

txtResults.Text = "You wrote " & Qmark & txtInput.Text & Qmark

End Sub

It works, but I just wanted to know if there was a nicer way.

Sequential File Quotation Marks?
Could someone of high intelligence please tell me if it's possible, and if it is, how you can write a sequential file so if you open it up in note pad, etc, and there aren't quotation marks around everything.

I only want the text, no formatting, just what I want to be there.

Continually grateful.

Shell, No QUOTATION Marks!! Stupid....
I'm trying to send a command line to a program from a shell command,
the command line is: bplay.exe "movie.avi" [-FS]

In vb its a little hard due to there being quotation marks,
I've tryed this and program just can't find the file,
please!! help me correct this syntax:

Shell (App.Path + "" + "bplay.exe " + Chr(34) + "movie.avi" + Chr(34) + " [-fs]")


Quotation Marks With WRITE Statement
Another Quick Question:

When I write to an external file using the write statement, it always puts quotation marks at the beginning and end of the string... is something wrong with my code??


NameOfPerson = "John Jacob Jingleheimer Smith"
Write #1, NameOfPerson

In the text file, I'll see:

"John Jacob Jingleheimer Smith" -- WITH THE QUOTES! (grrr)

I'm trying to use this program to write HTML files, and its driving me nutz... any suggestions??

Are there other commands used to write to a file???


<~~ Whisper ~~>

Replace Quotation Marks From A String.
Hi, I'm trying to replace the quotation marks from a string which is capture from a text file. I tried 'string = replace(string, ""","") but it dosen't work also I have tried to assing a single quotation mark to a variable but VB 6.0 puts te other one by default. I need some help fixing this problem.

Adding Quotation Marks When Writing To INI File
Hello, I'm having some problems with adding quotation marks when writing to an INI file.

I'm writing to the INI file with the following command. Text1 is a TextBox.

WriteIniValue (App.Path & "Settings.ini"), "Settings", "Path", Text1.Text

If the contents of the TextBox is C:New Folder, then in the INI file it looks like this:

Path=C:New Folder
I'd like to have quotation marks around the text from the TextBox, so it looks like this:

Path="C:New Folder"
I assume that I can do this with Replace(), but how do I do this when writing to an INI file ?


Double Quotation Marks Added To Txt File
Hi, i'm new to this forum and have a question.

I dont know how to download a text file without it having double-quotes being added to the comma delimited fields.

The text had already double-quotes for the fields! I use Inet1.openURL for that task but the server where the file is is a Unix one.

Any idea?


Problem With Quotation Marks In Outputting Files
using simple code that outputs to a text file leaves me with the text i wanted in quatation marks, is there any way to remove them?

say i had:

arr$ = "hello"
Open "arr.txt" For Output As #1
Write #1, arr
Close #1

when i open arr.txt it will say:

when i want it to jsut say
(no quotation marks)

is there any way to do that?

Remove Unwanted Quotation Marks From A String
Hi I need to strip quotation marks from a string before I update a database, I can't quite seem to think of how to do it, any Help??



Problem With Reading Quotation Marks As Strings In File
I'm having a problem where I have a list box that is used to display entries from an external data file. The data is stored as follows:

first line ... "string of text here","another string","and then some"
new line ... etc.

Now the problem is that in Form1, users are doing the input for the data file above and if for any reason they type in a quotation mark or two into that file, it gunks up the way VB reads the file and I get an Input Past EOF error. Is there a way to detect stray quotation marks in the file before it is read and inputted into the list box (idealy, they should be entering letters A-Z or numbers 0-9)? I'm a noob @ this error checking business w/ detecting stray characters, so I'm a bit @ a loss.

Saving Strings To Database With Quotation Marks And Apostrophes **Resolved**
Is there better way to allow a user to save to a database Quotation Marks and Apostrophes other that what I am doing below:

VB Code:
If strModeType = "Edit" Or strModeType = "Delete" Then ' Only run if in Edit or Delete Modes    If InStr(strItem, Chr(39)) > 0 Or _            InStr(strItem, Chr(34)) > 0 Then        For a = 1 To Len(strItem) ' Loop through strItem and convert each character                                  ' into ASCII            If a = 1 Then                strValue = "Chr$(" & Asc(Mid(strItem, a)) & ")"            Else                strValue = strValue & " & Chr$(" & Asc(Mid(strItem, a)) & ") "            End If        Next a                strItem = Trim(strValue)    Else        strItem = "'" & Trim(strItem) & "'" ' Item does not contain an Apostrophe  or                                        ' Quotation Mark    End IfElse    strItem = "'" & Trim(strItem) & "'" ' in Add ModeEnd If

Thanks in advance!

Escaped Quotation Marks? Using Spacebar To Export Registry Setting..
In reference to this old thread:

great_llama says in post #3:
Quote:I always use long names. Make sure that you always embed escaped quotation marks around things that might include spaces or other funny non-DOS-friendly characters.

What does he mean by "embed escaped quotation marks"? I am trying to export registry settings, but the key has spaces in its name. I tried replacing the spaces chr(32), %20 or + signs but this doesn't work.. obviously I am doing something wrong. Please help.

Writing Data To A File - Why Do I Get "quotation Marks"??
I'm reading each record from a file as a string, converting certain fields to integers and writing them out. Each record, when written out, is surrounded by " ". Why is this and what do I need to do to get rid of them.

Also, while I have your attention 8^)......

Is there a way to write out data and place it in a specific location in the output file? Right now I'm just inserting 'space' to get my data to line up right. Maybe that's why I'm having the " " problem? I've looked in my books and online and I can't seem to find a solution.


Copyright 2005-08, All rights reserved