Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Creating CSV files examples needed

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,50602
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
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!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Creating CSV files examples needed - 8/10/2007 11:22:42 PM   
  haydnward

 

Posts: 25
Score: 0
Joined: 7/27/2007
Status: offline
Hi

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?

Thanks.
 
 
Post #: 1
 
 RE: Creating CSV files examples needed - 8/10/2007 11:49:04 PM   
  dm_4ever


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 >


_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to haydnward)
 
 
Post #: 2
 
 RE: Creating CSV files examples needed - 8/12/2007 12:27:48 AM   
  haydnward

 

Posts: 25
Score: 0
Joined: 7/27/2007
Status: offline
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.

Any pointers would be great

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: Creating CSV files examples needed - 8/12/2007 3:50:13 AM   
  haydnward

 

Posts: 25
Score: 0
Joined: 7/27/2007
Status: offline
Hi I think I have figured it out:


      

Just need to keep adding to it now. As I said before I am really new to this so if anyone knows a better way I am more than willing to learn.

Thanks for all the help

Haydn

(in reply to haydnward)
 
 
Post #: 4
 
 RE: Creating CSV files examples needed - 8/12/2007 4:16:14 AM   
  dm_4ever


Posts: 2723
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
You could also do it with something like this.


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to haydnward)
 
 
Post #: 5
 
 RE: Creating CSV files examples needed - 8/12/2007 4:44:15 AM   
  haydnward

 

Posts: 25
Score: 0
Joined: 7/27/2007
Status: offline
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.

Thanks again Haydn

(in reply to dm_4ever)
 
 
Post #: 6
 
 RE: Creating CSV files examples needed - 8/12/2007 4:59:00 AM   
  dm_4ever


Posts: 2723
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
This could be one way.


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to haydnward)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Creating CSV files examples needed Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts