Hi can some one please help in checking to see if my code is right. There
seems to a error at tis line of code: date = mid( line, 1, csvPos - 1 ). And
i don't have a clue as to what the problem is.


dim filesys, filetxt, fileHandle, fileout
dim line, date, news, httplink, newline

Const ForReading = 1
Const ForWriting = 2

newline = chr(13) + chr(10)

' Open the input file
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("c:\vbscript\newslist.txt", ForReading,
false )

' Open the output file
Set fileHandle = CreateObject("Scripting.FileSystemObject")
Set fileout = fileHandle.OpenTextFile("c:\vbscript\newslist.html",
ForWriting, true )

' Create the newslist.js entries
line = filetxt.readline

Do until filetxt.AtEndOfStream
createNews line
line = filetxt.readline
loop

filetxt.Close
fileout.close

msgbox "Page has Created"

sub createNews( line )

dim date, news, httplink

' Get the date
csvPos = instr( line, "," )
date = mid( line, 1, csvPos - 1 )
line = mid( line, csvPos + 1 )

' Get the news item
csvPos = instr( line, "," )
news = mid( line, 1, csvPos - 1 )
line = mid( line, csvPos + 1 )

' Get the link
httplink = line

fileout.Writeline( "(<p><b>)" + date + "(:</b><br>)" )
fileout.Writeline( "(<a href=" + chr(34) + httplink + chr(34) + ">)" + news
+ "(</a></p>)" )

end sub

Re: Help? may be easy for some one by Joe

Joe
Wed Aug 18 07:37:56 CDT 2004

"Himesh Patel" <himeshp@vnvi.com> wrote in message
news:cfvbgv$n04$1$8302bc10@news.demon.co.uk...
> Hi can some one please help in checking to see if my code is right. There
> seems to a error at tis line of code: date = mid( line, 1, csvPos - 1 ).
And
> i don't have a clue as to what the problem is.
>

Date is a reserved word, it's the nae of a function returning the system
date.

--

Joe



Re: Help? may be easy for some one by Michael

Michael
Sat Aug 21 15:23:25 CDT 2004

Himesh Patel wrote:
> Hi can some one please help in checking to see if my code is right.
> There seems to a error at tis line of code: date = mid( line, 1,
> csvPos - 1 ). And i don't have a clue as to what the problem is.
>

What is the exact error number and error description?

What is the content in the line variable and what is the value of the csvPos
variable at the time of the error?


--
Michael Harris
Microsoft.MVP.Scripting
Sammamish WA US