Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: Operating Systems .: Windows Operating Systems .: Windows Scripts and Batch Files .: VB Script to Create and Write to File

VB Script to Create and Write to File

' Create Text file called Temp.txt
Dim fso
Dim ObjStream

Const TristateFalse = 0
Const FILE_LOCATION = "C:\"
Const FILE_NAME = "Temp.txt"

set Fso = CreateObject("Scripting.FilesystemObject")

set objStream = FSO.CreateTextFile(FILE_LOCATION & FILE_NAME, True, TristateFalse)

With ObjStream
.WriteLine "Test Line 1..."
.WriteLine "Test Line 2..."
.Write "The .Write command Writes with no carriage return at end of line."
.WriteBlankLines (2)
.WriteLine "Test Line 3..."
.Close
End With

MsgBox "File " & FILE_NAME & " was Created Successfully."


How helpful was this article to you?

Related Articles

article VB Script to Create a Random File Name
Option Explicit Dim objWshObject,...

(No rating)  3-24-2008    Views: 175   
article VB Script to Write to registry
Option Explicit Dim SysVarReg, Value...

(No rating)  3-24-2008    Views: 152   
article How to Write a Robots.txt File
SUMMARY Web Spiders, often called...

(No rating)  5-20-2008    Views: 70   

User Comments

Add Comment
No comments have been posted.