2010-11-06 33 views
0

不工作在我的Excel工作簿中的一個我已經創建了一個宏包含以下行:對錯誤轉到[標籤]在VBA

On Error GoTo saltaw 
Open fileout For Output As #iFileNumber 

然而,當fileout包含一些無效字符(「\」,爲例如)宏停止並出現錯誤窗口「運行時錯誤'76':找不到路徑」,就好像on error goto行不存在一樣。如果我用on error resume next替代on error goto也是一樣。宏停在下一行。爲什麼?

+1

[VBA錯誤處理在Excel中不工作](http://stackoverflow.com/questions/3440735/vba-error-handling-not-working-in-excel) – GSerg 2010-11-06 12:52:35

+0

可能重複[VBA錯誤處理不工作在Excel](https://stackoverflow.com/questions/3440735/vba-error-handling-not-working-in-excel) – niton 2017-07-09 02:26:43

回答

2

轉到Tools -> Options -> General並將Error Trapping設置爲更適合您的其他內容。

+0

啊,[發現它](http://stackoverflow.com/questions/) 3440735/vba-error-handling-not-working-in-excel)。我知道我以前見過它。 – GSerg 2010-11-06 12:53:27