Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Parse CSV file and display Column B in HTA ListBox

Reply
 
Old 09-20-2008   #1 (permalink)
Natron


 
 

Parse CSV file and display Column B in HTA ListBox

I have a CSV file including headers (don't want them in my listbox) with
several Columns which need I need to have parsed and displayed in an HTA.
Column B is the the only column I would like the user to see in a dropdown
listbox. The user will select from the listbox, then click a Submit Button.
Once clicked I have a vbscript already made which will take various fields
from the parsed data and create a second CSV file. Anyone know a simple way
to achomplish this? Any change in my process to make this easier? I
appreciate any comments or suggestions!

My System SpecsSystem Spec
Old 09-20-2008   #2 (permalink)
Joe Fawcett


 
 

Re: Parse CSV file and display Column B in HTA ListBox

"Natron" <Natron@xxxxxx> wrote in message
news:56A59099-C698-4A70-9E16-756961AC6CDB@xxxxxx
Quote:

> I have a CSV file including headers (don't want them in my listbox) with
> several Columns which need I need to have parsed and displayed in an HTA.
> Column B is the the only column I would like the user to see in a dropdown
> listbox. The user will select from the listbox, then click a Submit
> Button.
> Once clicked I have a vbscript already made which will take various fields
> from the parsed data and create a second CSV file. Anyone know a simple
> way
> to achomplish this? Any change in my process to make this easier? I
> appreciate any comments or suggestions!
Which part are you struggling with?
Opening and reading the file => FileSystemObject, OpenAsTextStream
Finding column B => Use Split function with comma
Creating the list options => Use documentGetElementById on the select then
create a new Option(text, value) and add it to the select.options collection
using add method


--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

My System SpecsSystem Spec
Old 09-20-2008   #3 (permalink)
Paul Randall


 
 

Re: Parse CSV file and display Column B in HTA ListBox


"Natron" <Natron@xxxxxx> wrote in message
news:56A59099-C698-4A70-9E16-756961AC6CDB@xxxxxx
Quote:

>I have a CSV file including headers (don't want them in my listbox) with
> several Columns which need I need to have parsed and displayed in an HTA.
> Column B is the the only column I would like the user to see in a dropdown
> listbox. The user will select from the listbox, then click a Submit
> Button.
> Once clicked I have a vbscript already made which will take various fields
> from the parsed data and create a second CSV file. Anyone know a simple
> way
> to achomplish this? Any change in my process to make this easier? I
> appreciate any comments or suggestions!
Most of Joe Fawcett's suggestions are 100% correct. If individual fields of
the CSV file contain commas, then his suggestion to split on commas will
fail to give you the correct results. Other solutions for this have been
posted in the past. Use GROUPS.google.com, and enter the following:

"example vbscript using the Microsoft Text Driver to open a CSV file "
group:*.scripting.vbscript

The above should be all one line.
You should get about two results, with sample code to extract the fields two
different ways.

-Paul Randall


My System SpecsSystem Spec
Old 09-20-2008   #4 (permalink)
Natron


 
 

Re: Parse CSV file and display Column B in HTA ListBox

Joe,
I appreciate the comments and suggestions for solving my issues. I was
looking for a place to start and was not finding many examples on the web.
(must be looking in the wrong places!) I will be trying your suggestions and
will post back with my results for all to learn from. Thanks again for the
speedy reply!

"Joe Fawcett" wrote:
Quote:

> "Natron" <Natron@xxxxxx> wrote in message
> news:56A59099-C698-4A70-9E16-756961AC6CDB@xxxxxx
Quote:

> > I have a CSV file including headers (don't want them in my listbox) with
> > several Columns which need I need to have parsed and displayed in an HTA.
> > Column B is the the only column I would like the user to see in a dropdown
> > listbox. The user will select from the listbox, then click a Submit
> > Button.
> > Once clicked I have a vbscript already made which will take various fields
> > from the parsed data and create a second CSV file. Anyone know a simple
> > way
> > to achomplish this? Any change in my process to make this easier? I
> > appreciate any comments or suggestions!
>
> Which part are you struggling with?
> Opening and reading the file => FileSystemObject, OpenAsTextStream
> Finding column B => Use Split function with comma
> Creating the list options => Use documentGetElementById on the select then
> create a new Option(text, value) and add it to the select.options collection
> using add method
>
>
> --
>
> Joe Fawcett (MVP - XML)
> http://joe.fawcett.name
>
>
My System SpecsSystem Spec
Old 09-20-2008   #5 (permalink)
Natron


 
 

Re: Parse CSV file and display Column B in HTA ListBox

Nice Search String Paul, thanks for the additional comments....I should have
this wrapped up later this week and will post back for any more suggestions
on the overall HTA. Thanks for the quick reply!

"Paul Randall" wrote:
Quote:

>
> "Natron" <Natron@xxxxxx> wrote in message
> news:56A59099-C698-4A70-9E16-756961AC6CDB@xxxxxx
Quote:

> >I have a CSV file including headers (don't want them in my listbox) with
> > several Columns which need I need to have parsed and displayed in an HTA.
> > Column B is the the only column I would like the user to see in a dropdown
> > listbox. The user will select from the listbox, then click a Submit
> > Button.
> > Once clicked I have a vbscript already made which will take various fields
> > from the parsed data and create a second CSV file. Anyone know a simple
> > way
> > to achomplish this? Any change in my process to make this easier? I
> > appreciate any comments or suggestions!
>
> Most of Joe Fawcett's suggestions are 100% correct. If individual fields of
> the CSV file contain commas, then his suggestion to split on commas will
> fail to give you the correct results. Other solutions for this have been
> posted in the past. Use GROUPS.google.com, and enter the following:
>
> "example vbscript using the Microsoft Text Driver to open a CSV file "
> group:*.scripting.vbscript
>
> The above should be all one line.
> You should get about two results, with sample code to extract the fields two
> different ways.
>
> -Paul Randall
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
reading the first column from a file PowerShell
Naming a text file from a selection in a listbox VB Script
Windows Explorer: Display File Size Column In Bytes? Vista file management
Where Is File Size Column on Search Screen? Vista General
file size column heading in search Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46