|
baomaboy 发表于 2011-11-29 09:29
你说以前用正常,而且很多人用都正常,说明工具集应该正常的,可能是你的使用环境有变化。
如果你是03 ...
闫总您好!
请教一个问题,谢谢!
就是,我想在程序运行出错后,记录下出错的过程或者函数名,以及出错的语句。能否做到?
Rem 错误处理程序
ErrHandler:
iCount9 = Sheets("Error").Range("A" & Rows.Count).End(xlUp).Row
i9 = iCount9 + 1
Sheets("Error").Cells(i9, "A") = Now()
Sheets("Error").Cells(i9, "B") = ActiveSheet.Name
Sheets("Error").Cells(i9, "C") = II
Sheets("Error").Cells(i9, "D") = JJ
Sheets("Error").Cells(i9, "E") = Err.Number
Sheets("Error").Cells(i9, "F") = Err.Description
Sheets("Error").Cells(i9, "G") = Err.Source & "." & Application.ActivateMicrosoftApp
Sheets("Error").Cells(i9, "H") = Err.HelpContext
Sheets("Error").Cells(i9, "I") = Environ("COMPUTERNAME")
Sheets("Error").Cells(i9, "J") = Application.UserName
MsgBox "程序运行过程中发现错误,请通知程序员!"
Resume Next
|
|