Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

FileSystemObject : CreateTextFile Method

Description: 

This func­tion cre­ates a file and returns a TextStream object and later you can use that TextStream object to per­form var­i­ous activ­ity on that file like read­ing or writing

Format :

objectOf­FileSys­te­mOb­ject. Cre­ate­TextFile (file­name[, over­write[, unicode]])

  • objectOf­FileSys­te­mOb­ject : As the names says, it’s a FileSystemObject.
Arguments: 
    • file­name
      • Manda­tory
      • Type:     String
      • File will be cre­ated with the same name what you will pass here.

  • Over­write
    • Optional
    • Type: Boolean (True: you can over­write the file, False for vice versa. By default its False.)
  • · Uni­code
    • Optional
    • Boolean (True: File cre­ated as Uni­code file, False: File cre­ated as ASCII file. By default: ASCII file)

 

Function FnCreateTextFile()         
   Set fso = CreateObject("Scripting.FileSystemObject")

  Set filetxt = fso.CreateTextFile("c:\sample.txt", True)
End Function 
  ' So here filetxt will store TextStreamObject in it.

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: