Sub Utilities Class

MaxLengthFileLinesSample

Signature (Visual Basic / VBA)

Private Sub MaxLengthFileLinesSample()
    Const strFn = "MaxLengthFileLinesSample"

    Dim strInFile As String
    strInFile = CombinePathAndFile(GetWindowsDirectory, "WIN.INI")
    strInFile = InputBox("Input file: ({Esc} cancels.)", strFn, strInFile)
    If Len(strInFile) = 0 Then Exit Sub

    MsgBox "Return = " & MaxLengthFileLines(strInFile) & " (-1 means failure; otherwise is length of longest line in file.)", vbInformation, strFn
End Sub