Set InputFile = fso.OpenTextFile("h:\usr\bin\MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
Ping = WshShell.Run("ping -n 1 " & iline(0), 0, True)
objExcel.Cells(intRow, 1).Value = UCase(iline(1))
if Ping=0 then z="On" else z="Off"
I put the "createobject" outside the loop for efficiency. Note that ping (on win-7) gives the computer name in its output if you use the -a option, in the first line, second token, then you would not need to maintain the cross-reference, but then you need to capture the ping data.