by Bhuwan Chand Joshi (69 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 21st July 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Creating a text file
Public sub Form_Load()
On error goto Err_Handler
Dim Obj as Object
Dim F1 as Object
Dim varArray as Variant
varArr=Array("Hello","MySelf","Bhuwan")
Set Obj=CreateObject("Scripting.FileSystemObject")
Set F1=Obj.CreateTextFile("Specify the path where you need to create text file like D:\Test.txt")
F1.writeline varArray(0) & " " & varArray(1) & " " & varArray(2)
F1.Close
Err_Handler:
MsgBox Err.Description
End Sub
'This program creates a text file Text.txt in the drive "D:"