Hi,
I have a function that looks like:
Sub Get_Calls_Data_Build_xxxyyy(Appendix_A, In_file, No_of_Rows, Append_File, Template_Type)
Dim killfile2 As String
On Error GoTo File_Not_Found
killfile2 = ThisWorkbook.Path & "\SomeErr.log"
'Check that file exists
If Len(Dir$(killfile2)) > 0 Then
'First remove readonly attribute, if set
SetAttr killfile2, vbNormal
'Then delete the file
Kill killfile2
End If
(Do stuff which raises error 62: Input past end of file)
File_Not_Found:
Open ThisWorkbook.Path & "\SomeErr.log" For Append As #7
'Open the file for Append
Print #7, Application.Text(Now(), "dd mmm yyyy HH:mm:ss"
_
& " " & Err & " " & Error(Err)
Close #7 'Close the log so it can be used again.
Call Auto_Close
End Sub
When it encounters Runtime error 62, it goes into the error-handler and raises another error (Runtime error 13 - type mismatch).
The weird thing is, if I am in debug mode, I don't get this error. But if I am in run-mode, I get this error. On clicking on "Debug" button of the runtime error, it quits the application, so I can never see which line is causing the error.
Any ideas, folks? What is wroong here? Why am I getting the runtime error 13?
-Anukta
I have a function that looks like:
Sub Get_Calls_Data_Build_xxxyyy(Appendix_A, In_file, No_of_Rows, Append_File, Template_Type)
Dim killfile2 As String
On Error GoTo File_Not_Found
killfile2 = ThisWorkbook.Path & "\SomeErr.log"
'Check that file exists
If Len(Dir$(killfile2)) > 0 Then
'First remove readonly attribute, if set
SetAttr killfile2, vbNormal
'Then delete the file
Kill killfile2
End If
(Do stuff which raises error 62: Input past end of file)
File_Not_Found:
Open ThisWorkbook.Path & "\SomeErr.log" For Append As #7
'Open the file for Append
Print #7, Application.Text(Now(), "dd mmm yyyy HH:mm:ss"
& " " & Err & " " & Error(Err)
Close #7 'Close the log so it can be used again.
Call Auto_Close
End Sub
When it encounters Runtime error 62, it goes into the error-handler and raises another error (Runtime error 13 - type mismatch).
The weird thing is, if I am in debug mode, I don't get this error. But if I am in run-mode, I get this error. On clicking on "Debug" button of the runtime error, it quits the application, so I can never see which line is causing the error.
Any ideas, folks? What is wroong here? Why am I getting the runtime error 13?
-Anukta