Tuesday, 3 March 2020

VB6 Program to read and print into a text file using freefile

Program to read and print into a text file

Dim sFileText as String
Dim iFileNo as Integer

iFileNo = FreeFile

'open the file for writing
  Open "C:\Test.txt" For Output As #iFileNo
'please note, if this file already exists it will be overwritten!

   'write some example text to the file
  Print #iFileNo, "first line of text"
  Print #iFileNo, "   second line of text"
  Print #iFileNo, ""  'blank line
  Print #iFileNo, "some more text!"

   'close the file (if you dont do this, you wont be able to open it again!)

  Close #iFileNo


No comments:

Post a Comment

VBScript: How to use Dictionary in VBScript | VBScript objects

=>To declare and create object of a vbscript dictionary: Dim objDictionary Set objDictionary = CreateObject("Scripting.Dictionar...