troubleshooting Question

Search a CSV to return a record

Avatar of petersz
petersz asked on
Visual Basic Classic
5 Comments1 Solution195 ViewsLast Modified:
Requirements:

Based on machine name search the csv based on the machine name and return the row.

This code stops right before the test machine.  and I need it to return the record.


      Path2 = "C:\temp\"
      
      Dim Fso,f,file,objLogFile
      Set objExcel = CreateObject("Excel.Application")
      Set objWorkbook = objExcel.Workbooks.Open _
    (Path2 & "\MachDB.csv")
   
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set objFolder = objFSO.GetFolder(Path1)
      
      intRow = 2

      Do
          Wscript.Echo "MachineName: " & objExcel.Cells(intRow, 1).Value
          Wscript.Echo "Subnet: " & objExcel.Cells(intRow, 2).Value
          Wscript.Echo "BankProServerIP: " & objExcel.Cells(intRow, 3).Value
          intRow = intRow + 1
      Loop Until objExcel.Cells(intRow,1).Value = "machine4"

      objExcel.Workbooks.Close
      objExcel.Quit
ASKER CERTIFIED SOLUTION
leonstryker
VP

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros