on error goto [label] not working in VBA

2019-08-24 13:37发布

In one of my Excel workbooks I have created a macro containing the following lines:

On Error GoTo saltaw
Open fileout For Output As #iFileNumber

However, when fileout contains some invalid chars ("\", for example) the macro stops and the error window "Runtime error '76': Path not found" appears, as if the on error goto line does not exist. Same if I substitute on error goto by on error resume next. The macro stops at the following line. Why?

1条回答
等我变得足够好
2楼-- · 2019-08-24 14:38

Go to Tools -> Options -> General and set Error Trapping to something else that better suits you.

查看更多
登录 后发表回答