All Forums >> [Scripting] >> WSH & Client Side VBScript >> Creating CSV files examples needed Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
I am trying to make a CSV file using VBscript. Where the user is asked a series of questions and will enter the answers through InputBoxs. The Answers can be either text or numbers. This program would have to loop untill the user is finished entering all the names. And the end result would be a csv file that would contain several fields and several lines of information.
Does anybody know of any example scrips out there that I could learn from?
Posts: 2723
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
A CSV is just a text file with commas as a seperator so look at FileSystemObject, OpenTextFile Method, and WriteLine Method and write out your users input seperating them with commas.
< Message edited by dm_4ever -- 8/10/2007 11:50:48 PM >
Brilliant thanks for that. I have been having a play and have got this far
The problem I am now having is getting the program to loop. I thought I could get it to work with a DO loop. In that it would stop when the user entered a 0 on the first question, but all that seems to happen is that it goes into some sort of enternal loop. Also I know there is a neater way of writing this code than putting all these IF statments in.
Cool so you use case when you want to enter a list of options. Still learning here.
I would also like one of the questions to ask the user to open a html file that is stored localy on their computer and copy the contents of that file into one of the fields in my CSV file. Is there a way of adding a browse function in VBscript to search for a file. Or is that asking to much.
Any examples that you know of that I can study would be great.