By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,591 Members | 650 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,591 IT Pros & Developers. It's quick & easy.

Sum data read from text file

P: 8
I had written a simple script using vbscript to read text file data line by line. On top of that i would like to grab the read data and perform calculation such as get the total sum. The data that i read is an integer. How should i continue from this? For example the data i got from this script are 1,2,3,4,5 i need to sum all these datas 1+2+3+4+5=15. Please help. Thank you

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\test2\test.txt", ForReading)

Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
arrServiceList = Split(strNextLine , ",")
For i = 3 to Ubound(arrServiceList)
Wscript.Echo "Service: " & arrServiceList(i)
Jul 12 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.