'**************************************** 'Reader- Reads the footnotes collected in TRACKER.CSV '**************************************** Sub MAIN Dim FName$, HelpTitle$, KeyTitle$, HelpID$, Browse$, KeyWord$, Comments$, BuildTag$ GetProjDir ffPath$, ffName$, ErrorLev 'What you'd think If ErrorLev <> 0 Then Goto Quit JustDir ffPath$ 'Separate the path from the file name... ChDir ffPath$ '...and change to that directory JustName ffName$ 'Separate the file name from the path Open ffName$ For Input As #1 'AppMinimize On Error Goto ErrorFound 'If something goes wrong, show some evidence before quitting 'create new document FileNew .NewTemplate = 0, .Template = "normal.dot" FormatPageSetup .AttributeControls = 0, .ApplyPropsTo = 4, .LeftMargin = ".5", \ .RightMargin = ".5", .TopMargin = ".5", .BottomMargin = ".5" FormatPageSetup .AttributeControls = 1, .ApplyPropsTo = 4, .Orientation = 1, \ .PageWidth = "11", .PageHeight = "8.5" FormatStyle .Name = "Normal", .BasedOn = "", .AddToTemplate = 0, .Define FormatDefineStyleChar .Font = "Helvetica", .Points = "8", .Bold = 0 TableInsertTable .ConvertFrom = 0, .NumColumns = 8, .NumRows = 1, .InitialColWidth = "Auto" TableSelectTable 'Get footnotes savecount = 0 'save every 10 iterations While Not Eof(1) Read #1, FName$, HelpTitle$, KeyTitle$, HelpID$, Browse$, KeyWord$, \ Comments$, BuildTag$ 'Now we should be in the first cell of the table Insert FName$ : NextCell Insert HelpTitle$ : NextCell Insert KeyTitle$ : NextCell Insert HelpID$ : NextCell Insert Browse$ : NextCell Insert KeyWord$ : NextCell Insert Comments$ : NextCell Insert BuildTag$ : NextCell If savecount = 10 Then 'save every 10 iterations savecount = 0 FileSaveAs .Name = "feet.doc" EndIf savecount = savecount + 1 Wend 'Add borders FormatBorder .FromText = "", .ApplyTo = 3, .Shadow = 0, .TopBorder = 3, .LeftBorder = 3, \ .BottomBorder = 3, .RightBorder = 3, .HorizBorder = 1, .VertBorder = 1 'Get rid of blank last row EndOfDocument LineUp 1 TableSelectRow EditCut AppRestore 'Make app as it was Goto GoodEnding 'Skip over error handler ErrorFound: 'Error handling routine. Show variables and exit gracefully AppRestore MsgBox "Error number " + Str$(err) ShowVars GoodEnding: Close #1 Quit: End Sub '**************************************** Sub GetProjDir(ffPath$, ffName$, ErrorLev) Dim NumFndFiles, i, n FileFind .Location = "All local drives", .Name = "*.csv", .Options = 0, .SortBy = 4 NumFndFiles = CountFoundFiles() Dim HPJ$(NumFndFiles) For i = 1 To NumFndFiles HPJ$(i - 1) = FoundFileName$(i) Next Begin Dialog UserDialog 558, 142, "Select a footnote file" ListBox 14, 43, 414, 84, HPJ$(), .ListBox1 OKButton 448, 43, 88, 21 CancelButton 448, 67, 88, 21 Text 14, 9, 475, 13, "Select the help footnote from which to read" Text 14, 22, 187, 13, "the footnote information." End Dialog Dim HPJ As UserDialog n = Dialog(HPJ) 'Figure out how to do On Error here If n = 0 Then ErrorLev = 1 ffName$ = HPJ$(HPJ.ListBox1) ffPath$ = ffName$ End Sub '**************************************** Sub JustDir(t$) 'Separate the path from the file name Dim i i = Len(t$) While Mid$(t$, i, 1) <> "\" i = i - 1 Wend i = i - 1 t$ = Left$(t$, i) End Sub '**************************************** Sub JustName(t$) 'Separate the file name from the path Dim i i = Len(t$) While Mid$(t$, i, 1) <> "\" i = i - 1 Wend i = Len(t$) - i t$ = Right$(t$, i) End Sub '****************************************