Public Sub VBLineNumbersAddSample() 'See also: ' VBLineNumbersAdd Function ' VBUtilitiesSample Subroutine Const strFn = "VBLineNumbersAddSample" Dim strInFile As String strInFile = InputBox("Input file: ({Esc} cancels.)", strFn, "\Entisoft\Tools\Samples.Txt") If Len(strInFile) = 0 Then Exit Sub Dim strOutFile As String strOutFile = GetTempFileName(Null, strFn) strOutFile = InputBox("Output file: (FILE WILL BE OVERWRITTEN; {Esc} cancels.)", strFn, strOutFile) If Len(strOutFile) = 0 Then Exit Sub Dim strStartingLineNum As String strStartingLineNum = InputBox("Starting line number: ({Esc} cancels.)", strFn, "1001") If Len(strStartingLineNum) = 0 Then Exit Sub Dim intIndentNonProgLines As Integer Select Case MsgBox("Indent non-program lines (comments and initial Case statements)?", vbQuestion + vbYesNoCancel + vbDefaultButton1, strFn) Case vbYes intIndentNonProgLines = True Case vbNo intIndentNonProgLines = False Case vbCancel Exit Sub Case Else Stop End Select Dim intOutdentNonProgLines As Integer Select Case MsgBox("Outdent non-program lines before adding line numbers? (i.e. has this file already had line numbers added to it with the ""indent non-program lines"" option?)", vbQuestion + vbYesNoCancel + vbDefaultButton2, strFn) Case vbYes intOutdentNonProgLines = True Case vbNo intOutdentNonProgLines = False Case vbCancel Exit Sub Case Else Stop End Select MsgBox "Return = " & VBLineNumbersAdd( _ vInFile:=strInFile, _ vOutFile:=strOutFile, _ vStartingLineNum:=strStartingLineNum, _ vIndentNonProgLines:=intIndentNonProgLines, _ vOutdentNonProgLines:=intOutdentNonProgLines _ ) & " (True means success; False means failure.)", vbInformation, strFn End Sub
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.