View Full Version : Solved: Need help in Opening and Reading simple text file.

12-09-2006, 01:03 AM
OK gang,
Being new to the VB world, I need a little more help now. I have been succussful in creating a Userform1 that I want to pull names from. I now need to create a simple text file and store it on my C:\. This should be easy enough. My problem is I need some advice on what might be the best way to store the data in the text file.

Are there any benefits or downsides to either of the two examples listed?

Example #1:
Butch Jones, Carol Jones, Sam Jones, Henry Jones,

Example #2:
Butch Jones
Carol Jones
Sam Jones
Henry Jones

Second question......
How would you code to read the data in the above listed text file if they were saved as C:\testfile.txt

When posting code, could you try and give a small definition as to what is going on so that the "newbie" can follow.... Have to take my baby steps first....

Thanks in advance,

12-09-2006, 09:54 AM
Hi Butch,
After reading the posts in this thread:
I thought Malcolm had answered this question for you(post 12 and 13)....you just needed to change the path in UserForm_Initialize to this: C:\MyNames.txt and create your file named MyNames.txt and save it to C:\ then run the excel file from anywhere.

attached zip has the excel file and the text file...save the text file to C:\ and run the excel file......I put this together from info Malcolm provided in the other thread so it's should be nothing new to you but maybe you misunderstood.

12-09-2006, 09:56 AM
Sorry I missed this part:
saved as C:\testfile.txt
just change the name of the text file and change the line of code in the initalized statement to C:\testfile.txt