How to write text to file??

bhuether
05-15-2003, 03:37 AM
I am new to VB and and trying to figure out how to do basic file I/O stuff like opening a file, writing some text and data to it, etc. I suppose that info is probably in my manual, but it is in German and my German is not quite that good!

-brian

Peit
05-15-2003, 03:56 AM
Use:

Print #X, String

With X as file number

PWNettle
05-15-2003, 09:33 AM
Dim lFileHandle As Long

' Get a safe file handle.
lFileHandle = FreeFile

' Open a file for output.
Open "c:\yourpath\yourfile.txt" For Output As #lFileHandle

' Write some data to the file.
Print #lFileHandle, "Your Text or Variable"

' Close the file.
Close #lFileHandle

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum