Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export to a text file ????

Status
Not open for further replies.

zishan619

Programmer
May 28, 2003
284
MX
Hi everyone:
How do I write code to export my data set to a text file on my C: drive in vbscript. Thank you
Z
 
You could use the FILE SCRIPTING OBJECT if the code is being run on your machine, if you are doing it through a webpage then you will need to either change the content-type being sent for your data or use ActiveX.
 
This is a function I use to manage writing of whatever I need to text files.

'This function manages writing information to a text file.
'The remarked out Constants set by the const key should be placed in the Variables section
'of your script at the top so they can be used within your script. This function only handles Writing and Appending.
Function WriteFile(Filename,Text,WriteMethod)
'Define Contants for WriteFile Subroutine
'Const ForReading = 1, ForWriting = 2, ForAppending=8
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(FileName, WriteMethod, True)
f.WriteLine Text
F.Close
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top