有一个普通的"环绕"通常在所有子例程中重复的代码(错误处理等):
Sub run1st()
On Error GoTo Dammit
Application.StatusBar = "Getting data from bla bla... "
OptimizeVBA True
'body of main code
continueProgress:
Application.StatusBar = False
OptimizeVBA False
Call Dash
Exit Sub
Dammit:
MsgBox "Something's wrong: " & vbCrLf & Err.Description
Resume continueProgress
Resume
End Sub
有没有办法传递主要代码'参数中的这个包装子或其他一些聪明的方法来避免这种混乱?