Click to See Complete Forum and Search --> : VBA and Excel macros
jigskins_k
May 11th, 2001, 12:41 AM
I would like to write macro to convert .txt file to .xls file. Basically, I wrote a batch file to run Ping Test for all the IP addresses. The output of all of them goes to another .txt file. I would like to make a report for all the IP address and status of its PING TEST. So, can any body guide me here?
thanks
jigskins
kjshelat
coolbiz
May 11th, 2001, 03:36 PM
The easiest way is to arrange the data in a comma delimited format and using .csv as the extension of the file. Excel should be set to open .CSV file automatically and format the data (column wise) based on the comma. Consider the following:
option Explicit
' array to hold the computer names
dim szComputers(30) as string
private Sub DoPing()
' open the output file
open "ping_results.csv" for output as #1
dim i as Integer
dim bStatus as Boolean
' loop through the comptuer names
for i = 1 to UBound(szComputers)
' Assume PingComp() will return true if destination replied, false otherwise
bStatus = PingComp(szComputers(i))
' write to the file - Chr(44) is a comma
print #1, szComputers(i) & Chr(34) & CStr(bStatus)
next i
' close the file
close #1
End Sub
-Cool Bizs
jigskins_k
May 22nd, 2001, 12:38 AM
Well, My problem is I want to retrieve data from .txt file. The program's requirement is create an application to do the ping test for different IP addresses. and show results in this manner that it comes in good table format.
kjshelat
coolbiz
May 22nd, 2001, 08:30 AM
So which part is the problem? Reading from the file for the computer names? Doing the Ping itself? Or Writing the output back to a file? :)
-Cool Bizs
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.