vb里On Error问题

来源:百度知道 编辑:UC知道 时间:2024/05/05 15:31:22
我用 ON ERROR发现错误。。但是我想知道是什么错误。。怎么样才能把ON ERROR错误的过程导出来。。
比如 我ON ERROR GO TO K
然后我就调用API(X,Y,Z)
EXIT SUB
然后那API报错。。。 我又不知道是X出错还是Y出错。。我想把K的执行过程调出来看看哪里出错。。怎么搞啊。。

我用n error goto K
函数
…………
exit sub
K: OPEN"F:\aa.txt" For Output As #1

Write #1, K
CLOSE K

不行。。导出来是空白的TXT。。。

请高手解释一下

Err.code 错误码
Err.Description 错误描述
代码可以修改为====================================

on error goto K
函数
…………
exit sub
K: OPEN"F:\aa.txt" For Output As #1

Write #1, err.description
CLOSE K

用这段代码:
open "c:\aa.txt" for output as #1
for i=1 to 500
print #1,i;error(i)
next i
close