Mega Code Archive

 
Categories / VisualBasic Script / File Path
 

Read a text file, adding the amounts

Sub wend()     Open "C:\Invoice.txt" For Input As #1     TotalSales = 0     While Not EOF(1)         Line Input #1, Data         TotalSales = TotalSales + Data     Wend     MsgBox "Total Sales=" & TotalSales     Close #1 End Sub