<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: write string to text file without quotes, or delete the quotes later in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216773#M47255</link>
    <description>Mandy, someone with some code will hopefully stop by. I'm pretty sure it's the way you're writing to the file (the method you're using)&lt;BR /&gt;
&lt;BR /&gt;
Would you mind posting some of your code?</description>
    <pubDate>Wed, 05 Jan 2005 20:56:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-01-05T20:56:50Z</dc:date>
    <item>
      <title>write string to text file without quotes, or delete the quotes later</title>
      <link>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216772#M47254</link>
      <description>I'm extracting data using AutoCAD VBA and writing to a text file.  However, whenever the data being written is contained in a string variable, it gets written with quotes around it.  I don't want the quotes included in the text file.  &lt;BR /&gt;
&lt;BR /&gt;
First question: Is there a way to write a string to a text file without the quotes around it?  &lt;BR /&gt;
&lt;BR /&gt;
Second question:  Is there a way to open a text file and do a Find and Replace?  I'm thinking that if I just wait until I have the text file completely written, I could then open the text file and do a Find and Replace to replace all quotes with nothing.  (This is what I have been doing manually in Notepad).   I would like to know how to do a Find and Replace, even if there is an answer to the first question...  just for future reference.&lt;BR /&gt;
&lt;BR /&gt;
Thanks much!</description>
      <pubDate>Wed, 05 Jan 2005 19:46:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216772#M47254</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-01-05T19:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: write string to text file without quotes, or delete the quotes later</title>
      <link>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216773#M47255</link>
      <description>Mandy, someone with some code will hopefully stop by. I'm pretty sure it's the way you're writing to the file (the method you're using)&lt;BR /&gt;
&lt;BR /&gt;
Would you mind posting some of your code?</description>
      <pubDate>Wed, 05 Jan 2005 20:56:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216773#M47255</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-01-05T20:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: write string to text file without quotes, or delete the quotes later</title>
      <link>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216774#M47256</link>
      <description>OK, this is not complete working code, but this gives the basic idea of what I am trying to do:  (I'm getting the circuit number from an object data table, and the start and end points of the line it is associated with, and writing this info to Circuit.txt)&lt;BR /&gt;
&lt;BR /&gt;
Dim CircuitNum As String&lt;BR /&gt;
Dim X0 As Variant, Y0 As Variant&lt;BR /&gt;
Dim X1 As Variant, Y1 As Variant&lt;BR /&gt;
&lt;BR /&gt;
strFileName = "C:\\circuit.txt"&lt;BR /&gt;
Open strFileName For Append As #1&lt;BR /&gt;
&lt;BR /&gt;
(bunch of table crap...  snip...  )&lt;BR /&gt;
&lt;BR /&gt;
   If (ODRecords.Record.TableName = "CIRCUIT") Then&lt;BR /&gt;
      CircuitNum = ODRecords.Record.Item(i).Value&lt;BR /&gt;
       ''''Write #1, CircuitNum    // if I do this Write, the circuit number will have quotes around it&lt;BR /&gt;
   End If&lt;BR /&gt;
&lt;BR /&gt;
  (...snip....)&lt;BR /&gt;
&lt;BR /&gt;
      Loop 'on the tables for the item&lt;BR /&gt;
      &lt;BR /&gt;
      'Before going on to next entity, get this entity's coords.&lt;BR /&gt;
      ObjectType = oAcadObj.ObjectName&lt;BR /&gt;
      &lt;BR /&gt;
       If (TableName = "CIRCUIT") Then&lt;BR /&gt;
           Select Case ObjectType&lt;BR /&gt;
          &lt;BR /&gt;
            Case "AcDbLine"&lt;BR /&gt;
               Set oLineObj = oAcadObj&lt;BR /&gt;
               X0 = oLineObj.StartPoint(0)&lt;BR /&gt;
               Y0 = oLineObj.StartPoint(1)&lt;BR /&gt;
               X1 = oLineObj.EndPoint(0)&lt;BR /&gt;
               Y1 = oLineObj.EndPoint(1)&lt;BR /&gt;
&lt;BR /&gt;
 ''''Write #1, CircuitNum, X0, Y0, X1, Y1     // if I write this way, the Circuit Number has quotes around it, but none of the coords do&lt;BR /&gt;
               &lt;BR /&gt;
               strData = CircuitNum &amp;amp; "," &amp;amp; X0 &amp;amp; "," &amp;amp; Y0 &amp;amp; "," &amp;amp; X1 &amp;amp; "," &amp;amp; Y1&lt;BR /&gt;
                             Write #1, strData    // by concatenating all of this into one string, now when I write there is one set of quotes around the entire string (before CircuitNum and after Y1)&lt;BR /&gt;
&lt;BR /&gt;
           End Select&lt;BR /&gt;
&lt;BR /&gt;
       End If 'table is circuit&lt;BR /&gt;
&lt;BR /&gt;
  Next 'go to next entity&lt;BR /&gt;
&lt;BR /&gt;
Close #1&lt;BR /&gt;
&lt;BR /&gt;
The Circuit number is something like 5P266, and what it writes to the text file is "5P266".   When I then write out the coordinates, these do not get the quotes around them.</description>
      <pubDate>Wed, 05 Jan 2005 21:45:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216774#M47256</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-01-05T21:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: write string to text file without quotes, or delete the quotes later</title>
      <link>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216775#M47257</link>
      <description>Mandy,
The Write# command puts quotes around string variables but not numeric
variables.  It's designed to work with the Read# command, which (I believe)
will strip the quotes off of a string variable if you Read# it in.  Use:

Print #1, strData    or
Print #1, CircuitNum &amp;amp; "," &amp;amp; X0 &amp;amp; "," &amp;amp; Y0 &amp;amp; "," &amp;amp; X1 &amp;amp; "," &amp;amp; Y1

to print out your concatenated line.  If you ever want to print to the file
without starting a new line afterward, put a semicolon (;) after your Print#
statement.

James


&amp;gt;  ''''Write #1, CircuitNum, X0, Y0, X1, Y1     // if I write this way, the
Circuit Number has quotes around it, but none of the coords do
&amp;gt;
&amp;gt;                strData = CircuitNum &amp;amp; "," &amp;amp; X0 &amp;amp; "," &amp;amp; Y0 &amp;amp; "," &amp;amp; X1 &amp;amp; ","
&amp;amp; Y1
&amp;gt;                              Write #1, strData    // by concatenating all
of this into one string, now when I write there is one set of quotes around
the entire string (before CircuitNum and after Y1)
&amp;gt;</description>
      <pubDate>Wed, 05 Jan 2005 22:33:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216775#M47257</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-01-05T22:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: write string to text file without quotes, or delete the quotes later</title>
      <link>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216776#M47258</link>
      <description>Try changing Write #1 to Print #1.&lt;BR /&gt;
Regards - Nathan</description>
      <pubDate>Wed, 05 Jan 2005 22:56:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216776#M47258</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-01-05T22:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: write string to text file without quotes, or delete the quotes later</title>
      <link>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216777#M47259</link>
      <description>Thank you James and Nathan.  I'm a newbie and just stumbling along using bits and pieces of other people's code!  So these tips are most helpful.</description>
      <pubDate>Thu, 06 Jan 2005 13:52:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/write-string-to-text-file-without-quotes-or-delete-the-quotes/m-p/1216777#M47259</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-01-06T13:52:01Z</dc:date>
    </item>
  </channel>
</rss>

