danucalovj

VB6 - Open and write file

Dec 11th, 2011
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. Dim sFileText as String
  2. Dim iFileNo as Integer
  3. iFileNo = FreeFile
  4. 'open the file for writing
  5. Open "C:\Test.txt" For Output As #iFileNo
  6. 'please note, if this file already exists it will be overwritten!
  7. 'write some example text to the file
  8. Print #iFileNo, "first line of text"
  9. Print #iFileNo, " second line of text"
  10. Print #iFileNo, "" 'blank line
  11. Print #iFileNo, "some more text!"
  12. 'close the file (if you dont do this, you wont be able to open it again!)
  13. Close #iFileNo
Advertisement
Add Comment
Please, Sign In to add comment