I am very new to VBA. I searched a lot on the <header>, but I still don't get it.
This is my sample code:
Sub test()
a = 10
b = 2
c = 10 / b
Debug.Print c
On Error GoTo x
x:
If Err > 1 Then
Debug.Print "The most recent error number is " & Err & _
". Its message text is: " & Error(Err)
End If
End Sub
How do I write the output of immediate window to a text file or if any error to errorlog.txt file?
I tried a little like this:
sub test()
dim gofs:set gofs=createobject("scripting.filesystemobject")
dim tsout:set tsout=gofs.createtextfile(output)