As the title says. If you're feeling especially generous, you could toss in a few lines so that the user is prompted for the filename as well


Thanks [:D]
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

1
This should work... If you ever get generous enough to share your salary with me, I'll think about your other request.[;)]

Msgbox sReadLine("C:\Boot.ini", 2)

Function sReadLine(sFilePath, iLine)

Dim oFso, i, hReadFile

Set oFso = CreateObject("Scripting.FileSystemObject")

Err.Clear
Set hReadFile = oFso.OpenTextFile(sFilePath, 1, False)
If Err.Number <> 0 Then sReadLine = "Error" : Exit Function

Do Until hReadFile.AtEndofStream

i = i + 1

sReadString = hReadFile.ReadLine

If i = iLine Then sReadLine = sReadString : Exit Function

If i > iLine Then sReadLine = "Not found" : Exit Function

Loop

If sReadLine = "" Then sReadLine = "Not found" : Exit Function

Set hReadFile = Nothing

Set oFso = Nothing

End Function
Answered 05/10/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Got it to work with some tweaking. Thanks. [:D]



BTW...all I was looking for w/ the user prompt was this:

stringuser=InputBox("Enter User Logon ","Computer Name Finder")
Msgbox sReadLine("v:\users\" & stringuser & ".txt", 2)


(syntax may be off as I used a different function in that fasion)
Answered 05/10/2005 by: Bladerun
Green Belt

Please log in to comment
0
I thought you wanted a fancy "Browse" dialog something like the following one.

Set oShl = createobject("shell.application")
Set oDir = oShl.BrowseforFolder(lngHwnd,sMessage, 80, 17)

Anyway, I'm glad it works. And thanks for the rating![:D]
Answered 05/10/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity