我有一个调用模块的过程。像这样的东西:
程序:
Sub Procedure()
Module1.SubProcedure()
If Global.Variable = "A" Then
...
End If
End Sub
模块1:
Sub SubProcedure()
If x then
Exit Sub
ElseIf y then
End
End If
End Sub
使用“结束”重置 Global.Variable。是否有任何替代“结束”的方法可以停止执行过程()并保留 Global.Variable 的值?
最佳答案
您可以使用函数而不是使用子过程,然后返回一个 bool 值,如下所示:
Function SubProcedure() as Boolean
If x then
SubProcedure = false
ElseIf y then
SubProcedure = true
End If
End Function
并将这些行添加到程序代码中:
if module1.subprocedure then
End
end if
关于vba - VBA 中 End 语句的替代方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28056458/