Network Engineer -- A Looking Glass

A look into my work as a Network Engineer

Tuesday, March 07, 2006

Read Any File Line by Line


Option Explicit

Dim objFSO
Dim filePath,arrLines(),y,strComputer

Set objFSO = CreateObject("Scripting.FileSystemObject")

filePath = "ip_list.txt"

readEntireFile(filePath)

For y=0 To UBound(arrLines)
strComputer = arrLines(y)
MsgBox strComputer,0,"Array Element: " & y
Next


'*******************************************************
Function readEntireFile(path)

Const ForReading = 1
Dim myFile, x
Set myFile = objFSO.OpenTextFile(path, ForReading, False)
x=0

Do While myFile.AtEndOfStream <> True
ReDim Preserve arrLines(x)
arrLines(x) = myFile.ReadLine
x=x+1
Loop

myFile.Close

readEntireFile = arrLines

End Function
'*********************************************|
Posted by Scot Geer at 6:20 AM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Favorite Blogs

  • I ♥ WiFi
  • Network Fun!!!

Blog Archive

  • ►  2016 (2)
    • ►  August (1)
    • ►  February (1)
  • ►  2015 (8)
    • ►  June (4)
    • ►  May (1)
    • ►  April (3)
  • ►  2014 (7)
    • ►  August (1)
    • ►  July (2)
    • ►  June (2)
    • ►  May (2)
  • ►  2013 (2)
    • ►  May (2)
  • ►  2010 (1)
    • ►  October (1)
  • ►  2008 (1)
    • ►  August (1)
  • ►  2007 (1)
    • ►  May (1)
  • ▼  2006 (11)
    • ▼  March (1)
      • Read Any File Line by Line
    • ►  February (6)
    • ►  January (4)
  • ►  2005 (4)
    • ►  December (4)
Simple theme. Theme images by luoman. Powered by Blogger.