Computing.Net > Forums > Programming > How to create a text file using FSO

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to create a text file using FSO

Reply to Message Icon

Name: benchph
Date: April 27, 2004 at 18:18:27 Pacific
OS: win2k
CPU/Ram: p4 1.7
Comment:

guys,

do you know how to create a text file using FileSystemObjects in Visual Basic 6.0?
thanks in advance....



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: April 28, 2004 at 02:19:39 Pacific
Reply:

Yes, don't use the FSO for a start. It cumbersome, slow and heavy on resources and has no place in VB6. If you intend distributing you application, using the FSO can add another couple of Mbs to the distribution files. It was designed to be used with VB scripting and just happens to be usable in VB 6.

Open "Test.txt" For Output As #1 will create an empty file in the default folder. The file name can can contain a fully qualified path name.

Write #1, "Text string" with write the string to the file

Close #1 will close the file.

One the file is created Open "Test.txt" For Input As #1 to read the file. This will create an error if the file does not exist.

Look up Open, Read, Write, Print and Input statements in the VB help files for for all the possible uses and parameters.

Stuart


0
Reply to Message Icon

Related Posts

See More


AnyOne Knows VB! HTML - Forms below each o...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: How to create a text file using FSO

how to creat a bat file which RAM www.computing.net/answers/programming/how-to-creat-a-bat-file-which-ram/17192.html

how to creat a NEW .dat file in C? www.computing.net/answers/programming/how-to-creat-a-new-dat-file-in-c/4558.html

how to create a batch 837 file www.computing.net/answers/programming/how-to-create-a-batch-837-file/15547.html