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 - Reading A Text File

Reply
 
Old 08-19-2009   #1 (permalink)
vqthomf


 
 

Reading A Text File

Hi I am new to VBScript I work in VBA, I am trying to read a text file held
on the C drive we are not working on a server we trying to just add the code
into a asp/html file and running it in IE6. We have found that what ever we
do we can't get it to work, we are trying to populate a combobox with the
contents of the text file can any body please help.

This the code we have tried
<%
Set fs=CreateObject("Scripting.FileSystemObject")

Set f=fs.OpenTextFile("C:\Data\Test1.txt, 1)
document.Write(f.ReadLine)
f.Close

Set f=Nothing
Set fs=Nothing
%>


My System SpecsSystem Spec
Old 08-19-2009   #2 (permalink)
Eric


 
 

Re: Reading A Text File


"vqthomf" <vqthomf@xxxxxx> wrote in message
news:3CB21BC3-DEAF-4A64-B6CD-0AAB37AD7524@xxxxxx
Quote:

> Hi I am new to VBScript I work in VBA, I am trying to read a text file
> held
> on the C drive we are not working on a server we trying to just add the
> code
> into a asp/html file and running it in IE6. We have found that what ever
> we
> do we can't get it to work, we are trying to populate a combobox with the
> contents of the text file can any body please help.
>
> This the code we have tried
> <%
> Set fs=CreateObject("Scripting.FileSystemObject")
>
> Set f=fs.OpenTextFile("C:\Data\Test1.txt, 1)
> document.Write(f.ReadLine)
> f.Close
>
> Set f=Nothing
> Set fs=Nothing
> %>
>
Does the text file contain more than one line of text? If so you'll need
more than one ReadLine method. If you want everything at once, try ReadAll.
For more info, see: http://www.devguru.com/technologies/VBScript/14118.asp


My System SpecsSystem Spec
Old 08-19-2009   #3 (permalink)
vqthomf


 
 

RE: Reading A Text File

Well after trying all day yesterday it actually works thanks for the help
much appreciated.

"vqthomf" wrote:
Quote:

> Hi I am new to VBScript I work in VBA, I am trying to read a text file held
> on the C drive we are not working on a server we trying to just add the code
> into a asp/html file and running it in IE6. We have found that what ever we
> do we can't get it to work, we are trying to populate a combobox with the
> contents of the text file can any body please help.
>
> This the code we have tried
> <%
> Set fs=CreateObject("Scripting.FileSystemObject")
>
> Set f=fs.OpenTextFile("C:\Data\Test1.txt, 1)
> document.Write(f.ReadLine)
> f.Close
>
> Set f=Nothing
> Set fs=Nothing
> %>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Reading text file at a URL VB Script
Reading file names and Searching for text VB Script
Reading a text file with StreamReader .NET General
Refresh on Reading more than one variable from a Text file VB Script
Reading text file and charting them via powergadget PowerShell


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