我尝试了很多次,发现如果存在语法错误,则无法通过错误处理来处理,我的代码如下:
Option Explicit
Option Compare Text
Sub BRRReport()
On Error GoTo errBRR
Dim ColLan, ColLsd As String
Dim strSheetN As String
check:
With Sheets(strSheetN)
'some stuff here
End With
Done:
Exit Sub
errBRR:
ThisWorkbook.Saved = True
Application.Quit
End Sub