I have a Function that tracks uses of my program and every once in a while
I get an error Error #62 Input past end of file. It seems a value is not written to the file in some cases and the error occurs because the file is empty. Why does a value not get written to the in the FirstLoad part of the function ?
Code:Function Countit() Dim fnumber As Integer Dim fNumber2 As Integer Dim File1 As String Dim File2 As String Dim Value1 As String Dim Value2 As String Dim Count1 As String Dim Count2 As String On Error Goto e File1 = gPathWithOutFolder & "\xpW32vst.syv"'path set in sub main File2 = gPathWithOutFolder & "\xpW32sys.xyp" fnumber = FreeFile() 80 If FileExists(File1) Then 90 Open File1 For Input As #fnumber ' Debug.Print FileLen(File1) 'If FileLen(File1) <> 0 Then 100 Line Input #fnumber, Value1 'error here on some systems 110 'Debug.Print File1 120 Close #fnumber 130 Else 140 GoTo FirstLoad ' End If ' 150 End If FirstLoad: 510 Open File1 For Output As #fnumber 520 Count1 = 1 530 Print #fnumber, Count1 540 Close #fnumber 550 Open File2 For Output As #fnumber 560 Count2 = 1 570 Print #fnumber, Count2 580 Close #fnumber





Reply With Quote