<?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 populating a listbox with text in a txt file. in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326111#M91899</link>
    <description>(im learning)&lt;BR /&gt;
I would like my vb prog to read a txt file and populate a listbox.&lt;BR /&gt;
The items in a txt file will be added to from time to time.&lt;BR /&gt;
&lt;BR /&gt;
I appreciate your help.&lt;BR /&gt;
thanks</description>
    <pubDate>Tue, 18 Jul 2000 02:45:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2000-07-18T02:45:30Z</dc:date>
    <item>
      <title>populating a listbox with text in a txt file.</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326111#M91899</link>
      <description>(im learning)&lt;BR /&gt;
I would like my vb prog to read a txt file and populate a listbox.&lt;BR /&gt;
The items in a txt file will be added to from time to time.&lt;BR /&gt;
&lt;BR /&gt;
I appreciate your help.&lt;BR /&gt;
thanks</description>
      <pubDate>Tue, 18 Jul 2000 02:45:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326111#M91899</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-07-18T02:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: populating a listbox with text in a txt file.</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326112#M91900</link>
      <description>Assuming each line in the text file is to become one line in a list box:&lt;BR /&gt;
&lt;BR /&gt;
Create a file called "sample.txt" and save it in your TEMP folder on C:&lt;BR /&gt;
drive. Here's the data I used (you can use whatever you like):&lt;BR /&gt;
&lt;BR /&gt;
Line 1&lt;BR /&gt;
Line 2&lt;BR /&gt;
Line 3&lt;BR /&gt;
Line 4&lt;BR /&gt;
Line 5&lt;BR /&gt;
&lt;BR /&gt;
Enter the VBAIDE, add a UserForm. Place a listbox on the UserForm and place&lt;BR /&gt;
this code in the UserForm's Initialize event (fair warning; there's *no*&lt;BR /&gt;
error checking):&lt;BR /&gt;
&lt;BR /&gt;
    fh = FreeFile&lt;BR /&gt;
    Open "c:\temp\sample.txt" For Input As #fh&lt;BR /&gt;
&lt;BR /&gt;
    Do While Not EOF(fh)&lt;BR /&gt;
&lt;BR /&gt;
        Line Input #fh, tmp&lt;BR /&gt;
        ListBox1.AddItem tmp&lt;BR /&gt;
&lt;BR /&gt;
    Loop&lt;BR /&gt;
    Close fh&lt;BR /&gt;
&lt;BR /&gt;
Run the form and the contents of the text file will be placed in the list&lt;BR /&gt;
box.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Attitudes are contagious. Is yours worth catching?&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
&lt;BR /&gt;
Jeremy &lt;JRSCEI&gt; wrote in message&lt;BR /&gt;
news:ef2c43e.-1@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; (im learning)&lt;BR /&gt;
&amp;gt; I would like my vb prog to read a txt file and populate a listbox.&lt;BR /&gt;
&amp;gt; The items in a txt file will be added to from time to time.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I appreciate your help.&lt;BR /&gt;
&amp;gt; thanks&lt;BR /&gt;
&amp;gt;&lt;/JRSCEI&gt;</description>
      <pubDate>Tue, 18 Jul 2000 03:14:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326112#M91900</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-07-18T03:14:50Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326113#M91901</link>
      <description>Thanks, I was hoping someone else was awake out there.&lt;BR /&gt;
Frank Oquendo &lt;FRANKO&gt; wrote in message&lt;BR /&gt;
news:ef2c43e.0@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; Assuming each line in the text file is to become one line in a list box:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Create a file called "sample.txt" and save it in your TEMP folder on C:&lt;BR /&gt;
&amp;gt; drive. Here's the data I used (you can use whatever you like):&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Line 1&lt;BR /&gt;
&amp;gt; Line 2&lt;BR /&gt;
&amp;gt; Line 3&lt;BR /&gt;
&amp;gt; Line 4&lt;BR /&gt;
&amp;gt; Line 5&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Enter the VBAIDE, add a UserForm. Place a listbox on the UserForm and&lt;BR /&gt;
place&lt;BR /&gt;
&amp;gt; this code in the UserForm's Initialize event (fair warning; there's *no*&lt;BR /&gt;
&amp;gt; error checking):&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     fh = FreeFile&lt;BR /&gt;
&amp;gt;     Open "c:\temp\sample.txt" For Input As #fh&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     Do While Not EOF(fh)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;         Line Input #fh, tmp&lt;BR /&gt;
&amp;gt;         ListBox1.AddItem tmp&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     Loop&lt;BR /&gt;
&amp;gt;     Close fh&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Run the form and the contents of the text file will be placed in the list&lt;BR /&gt;
&amp;gt; box.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; Attitudes are contagious. Is yours worth catching?&lt;BR /&gt;
&amp;gt; http://www.acadx.com&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Jeremy &lt;JRSCEI&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:ef2c43e.-1@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; &amp;gt; (im learning)&lt;BR /&gt;
&amp;gt; &amp;gt; I would like my vb prog to read a txt file and populate a listbox.&lt;BR /&gt;
&amp;gt; &amp;gt; The items in a txt file will be added to from time to time.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; I appreciate your help.&lt;BR /&gt;
&amp;gt; &amp;gt; thanks&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/JRSCEI&gt;&lt;/FRANKO&gt;</description>
      <pubDate>Tue, 18 Jul 2000 03:17:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326113#M91901</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-07-18T03:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: populating a listbox with text in a txt file.</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326114#M91902</link>
      <description>Can you explain to me why you used the "#fh" instead of #1 or any other number for that matter?&lt;BR /&gt;
&lt;BR /&gt;
Would it work the same if it were #1, #2, etc.?</description>
      <pubDate>Wed, 27 Aug 2008 02:26:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326114#M91902</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-27T02:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: populating a listbox with text in a txt file.</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326115#M91903</link>
      <description>You generally would use a style similar to the following:&lt;BR /&gt;
&lt;BR /&gt;
Dim File As Integer&lt;BR /&gt;
&lt;BR /&gt;
  'get a handle to file&lt;BR /&gt;
  File = FreeFile&lt;BR /&gt;
&lt;BR /&gt;
  'write the Text to file&lt;BR /&gt;
  Open strFilename For Append Access Write As #File&lt;BR /&gt;
    Write #File, "Text objects"&lt;BR /&gt;
&lt;BR /&gt;
    'write each Text object to file&lt;BR /&gt;
    For Each objAcadText In objSelectionSet&lt;BR /&gt;
      Write #File, TextString&lt;BR /&gt;
    Next objAcadText&lt;BR /&gt;
&lt;BR /&gt;
  Close #File&lt;BR /&gt;
&lt;BR /&gt;
Personally, I would opt using the Microsoft FileSystemObject for tasks such &lt;BR /&gt;
as this.&lt;BR /&gt;
&lt;BR /&gt;
Joe ...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;HENDERSONDAYTON&gt; wrote in message news:6016763@discussion.autodesk.com...&lt;BR /&gt;
Can you explain to me why you used the "#fh" instead of #1 or any other &lt;BR /&gt;
number for that matter?&lt;BR /&gt;
&lt;BR /&gt;
Would it work the same if it were #1, #2, etc.?&lt;/HENDERSONDAYTON&gt;</description>
      <pubDate>Wed, 27 Aug 2008 12:40:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326115#M91903</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-27T12:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: populating a listbox with text in a txt file.</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326116#M91904</link>
      <description>And the opposite would be the following:&lt;BR /&gt;
&lt;BR /&gt;
Dim File As Integer&lt;BR /&gt;
Dim TextLine As String&lt;BR /&gt;
&lt;BR /&gt;
  File = FreeFile&lt;BR /&gt;
&lt;BR /&gt;
  Open strFilename For Input Access Read As #File&lt;BR /&gt;
    Do While Not EOF(File)&lt;BR /&gt;
      Line Input #File, TextLine&lt;BR /&gt;
      MsgBox TextLine&lt;BR /&gt;
    Loop&lt;BR /&gt;
  Close #File&lt;BR /&gt;
&lt;BR /&gt;
Joe ...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Joe Sutphin" &lt;JOESUTPHIN&gt; wrote in message &lt;BR /&gt;
news:6017029@discussion.autodesk.com...&lt;BR /&gt;
You generally would use a style similar to the following:&lt;BR /&gt;
&lt;BR /&gt;
Dim File As Integer&lt;BR /&gt;
&lt;BR /&gt;
  'get a handle to file&lt;BR /&gt;
  File = FreeFile&lt;BR /&gt;
&lt;BR /&gt;
  'write the Text to file&lt;BR /&gt;
  Open strFilename For Append Access Write As #File&lt;BR /&gt;
    Write #File, "Text objects"&lt;BR /&gt;
&lt;BR /&gt;
    'write each Text object to file&lt;BR /&gt;
    For Each objAcadText In objSelectionSet&lt;BR /&gt;
      Write #File, TextString&lt;BR /&gt;
    Next objAcadText&lt;BR /&gt;
&lt;BR /&gt;
  Close #File&lt;BR /&gt;
&lt;BR /&gt;
Personally, I would opt using the Microsoft FileSystemObject for tasks such&lt;BR /&gt;
as this.&lt;BR /&gt;
&lt;BR /&gt;
Joe ...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;HENDERSONDAYTON&gt; wrote in message news:6016763@discussion.autodesk.com...&lt;BR /&gt;
Can you explain to me why you used the "#fh" instead of #1 or any other&lt;BR /&gt;
number for that matter?&lt;BR /&gt;
&lt;BR /&gt;
Would it work the same if it were #1, #2, etc.?&lt;/HENDERSONDAYTON&gt;&lt;/JOESUTPHIN&gt;</description>
      <pubDate>Wed, 27 Aug 2008 12:41:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326116#M91904</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-27T12:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: populating a listbox with text in a txt file.</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326117#M91905</link>
      <description>Hi Joe,&lt;BR /&gt;
&lt;BR /&gt;
What do you see as the advantage of the FSO compared with the VB method?&lt;BR /&gt;
&lt;BR /&gt;
I looked in your book for a reference to it, but found nothing.&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Laurie Comerford&lt;BR /&gt;
&lt;BR /&gt;
  Joe Sutphin wrote:&lt;BR /&gt;
&amp;gt; You generally would use a style similar to the following:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Dim File As Integer&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;   'get a handle to file&lt;BR /&gt;
&amp;gt;   File = FreeFile&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;   'write the Text to file&lt;BR /&gt;
&amp;gt;   Open strFilename For Append Access Write As #File&lt;BR /&gt;
&amp;gt;     Write #File, "Text objects"&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;     'write each Text object to file&lt;BR /&gt;
&amp;gt;     For Each objAcadText In objSelectionSet&lt;BR /&gt;
&amp;gt;       Write #File, TextString&lt;BR /&gt;
&amp;gt;     Next objAcadText&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;   Close #File&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Personally, I would opt using the Microsoft FileSystemObject for tasks such &lt;BR /&gt;
&amp;gt; as this.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Joe ...&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;HENDERSONDAYTON&gt; wrote in message news:6016763@discussion.autodesk.com...&lt;BR /&gt;
&amp;gt; Can you explain to me why you used the "#fh" instead of #1 or any other &lt;BR /&gt;
&amp;gt; number for that matter?&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Would it work the same if it were #1, #2, etc.?&lt;/HENDERSONDAYTON&gt;</description>
      <pubDate>Wed, 27 Aug 2008 22:14:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326117#M91905</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-27T22:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: populating a listbox with text in a txt file.</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326118#M91906</link>
      <description>I was surprised at that too&lt;BR /&gt;
FSO is universally denigrated on the "real" vb groups&lt;BR /&gt;
security issues, bloated object being stated as the two reasons not to use &lt;BR /&gt;
it.&lt;BR /&gt;
mark&lt;BR /&gt;
&lt;BR /&gt;
"Laurie Comerford" &lt;LAURIE&gt; wrote in message &lt;BR /&gt;
news:6017858@discussion.autodesk.com...&lt;BR /&gt;
Hi Joe,&lt;BR /&gt;
&lt;BR /&gt;
What do you see as the advantage of the FSO compared with the VB method?&lt;BR /&gt;
&lt;BR /&gt;
I looked in your book for a reference to it, but found nothing.&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Laurie Comerford&lt;BR /&gt;
&lt;BR /&gt;
  Joe Sutphin wrote:&lt;BR /&gt;
&amp;gt; Personally, I would opt using the Microsoft FileSystemObject for tasks &lt;BR /&gt;
&amp;gt; such&lt;BR /&gt;
&amp;gt; as this.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Joe ...&lt;BR /&gt;
&amp;gt;&lt;/LAURIE&gt;</description>
      <pubDate>Wed, 27 Aug 2008 23:31:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-a-listbox-with-text-in-a-txt-file/m-p/326118#M91906</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-27T23:31:55Z</dc:date>
    </item>
  </channel>
</rss>

