<?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: Reading text files in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/reading-text-files/m-p/344845#M80490</link>
    <description>Add error trapping and some common sense. I scribbled this off the top of my&lt;BR /&gt;
head so no telling if it'll work as written:&lt;BR /&gt;
&lt;BR /&gt;
Dim fh As Integer, tmp As String&lt;BR /&gt;
Dim tokens() As String, token&lt;BR /&gt;
&lt;BR /&gt;
fh = FreeFile&lt;BR /&gt;
Open &lt;FILEPATH&gt; for Input As fh&lt;BR /&gt;
Do While Not EOF(fh)&lt;BR /&gt;
    Line Input fh,tmp&lt;BR /&gt;
    tokens = Split(tmp, ",")&lt;BR /&gt;
    For Each token In tokens&lt;BR /&gt;
        '&lt;DO your="" thing=""&gt;&lt;BR /&gt;
    Next&lt;BR /&gt;
Loop&lt;BR /&gt;
Close fh&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
"That's no ordinary rabbit"&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Edward Bagby" &lt;EBAGBY&gt; wrote in message&lt;BR /&gt;
news:BC75E7833547BE999797B72DECC79221@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I would like to parse a text file when the data is separated by commas for&lt;BR /&gt;
&amp;gt; use in autocad blocks.&lt;BR /&gt;
&amp;gt; Anybody have an idea of how this can be done in visual basic?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thank you,&lt;BR /&gt;
&amp;gt; Edward&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/EBAGBY&gt;&lt;/DO&gt;&lt;/FILEPATH&gt;</description>
    <pubDate>Mon, 08 Oct 2001 11:32:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2001-10-08T11:32:54Z</dc:date>
    <item>
      <title>Reading text files</title>
      <link>https://forums.autodesk.com/t5/vba-forum/reading-text-files/m-p/344843#M80488</link>
      <description>I would like to parse a text file when the data is separated by commas for&lt;BR /&gt;
use in autocad blocks.&lt;BR /&gt;
Anybody have an idea of how this can be done in visual basic?&lt;BR /&gt;
&lt;BR /&gt;
Thank you,&lt;BR /&gt;
Edward</description>
      <pubDate>Mon, 08 Oct 2001 10:25:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/reading-text-files/m-p/344843#M80488</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-10-08T10:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reading text files</title>
      <link>https://forums.autodesk.com/t5/vba-forum/reading-text-files/m-p/344844#M80489</link>
      <description>The most simple solution is to let the existing applications do the job.&lt;BR /&gt;
Import the text file in Excel using the import functionality to separate the&lt;BR /&gt;
text into Excel Cells.&lt;BR /&gt;
Then use VBA to "read" the cells.&lt;BR /&gt;
&lt;BR /&gt;
When you want to do the parsing your self then youre code would look like&lt;BR /&gt;
1. Open the file&lt;BR /&gt;
2. Read line&lt;BR /&gt;
3. Look for ","&lt;BR /&gt;
4. Look for text start (") in the first part, when uneven then repeat 3&lt;BR /&gt;
5. use the MID() function to remove the first part from the line, repeat 3&lt;BR /&gt;
6. repeat 2, when not EOF&lt;BR /&gt;
7. Close file</description>
      <pubDate>Mon, 08 Oct 2001 10:43:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/reading-text-files/m-p/344844#M80489</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-10-08T10:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reading text files</title>
      <link>https://forums.autodesk.com/t5/vba-forum/reading-text-files/m-p/344845#M80490</link>
      <description>Add error trapping and some common sense. I scribbled this off the top of my&lt;BR /&gt;
head so no telling if it'll work as written:&lt;BR /&gt;
&lt;BR /&gt;
Dim fh As Integer, tmp As String&lt;BR /&gt;
Dim tokens() As String, token&lt;BR /&gt;
&lt;BR /&gt;
fh = FreeFile&lt;BR /&gt;
Open &lt;FILEPATH&gt; for Input As fh&lt;BR /&gt;
Do While Not EOF(fh)&lt;BR /&gt;
    Line Input fh,tmp&lt;BR /&gt;
    tokens = Split(tmp, ",")&lt;BR /&gt;
    For Each token In tokens&lt;BR /&gt;
        '&lt;DO your="" thing=""&gt;&lt;BR /&gt;
    Next&lt;BR /&gt;
Loop&lt;BR /&gt;
Close fh&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
"That's no ordinary rabbit"&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Edward Bagby" &lt;EBAGBY&gt; wrote in message&lt;BR /&gt;
news:BC75E7833547BE999797B72DECC79221@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I would like to parse a text file when the data is separated by commas for&lt;BR /&gt;
&amp;gt; use in autocad blocks.&lt;BR /&gt;
&amp;gt; Anybody have an idea of how this can be done in visual basic?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thank you,&lt;BR /&gt;
&amp;gt; Edward&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/EBAGBY&gt;&lt;/DO&gt;&lt;/FILEPATH&gt;</description>
      <pubDate>Mon, 08 Oct 2001 11:32:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/reading-text-files/m-p/344845#M80490</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-10-08T11:32:54Z</dc:date>
    </item>
  </channel>
</rss>

