【发布时间】:2013-09-18 12:13:43
【问题描述】:
我有一个宏 (CMOV),它调用另一个子例程 (CMOV2),它检查一个条件,如果满足,将显示一个 vbokaycancel 消息框,我将它设置为一个名为 irep 的变量,
如果有人点击取消 (irep=2) 来取消整个宏,我想要它。即不仅退出CMOV2,也退出CMOV。
目前,我有
If jackal(1) <> vbNullString Then
irep = MsgBox("Warning: You have a selection with two swingarms" _
& " that are on the same radius and cannot swing past one another " _
& Chr$(13) & " Choose Okay if you still wish to proceed otherwise " _
& " choose Cancel to revise your order" & Chr$(13) & " " _
& jackal(1) & Chr$(13) & " " & jackal(2), vbOKCancel)
**If irep = 2 Then
Exit Sub**
Else: End If
Else: End If
End Sub
在子程序的末尾。问题是即使退出 CMOV2,CMOV 仍会继续运行。有没有办法结束这个子,以及调用它的那个?
【问题讨论】:
-
尝试在 CMOV2 中创建一个名为 plzexit 的变量,然后在 CMOV 中创建一个 if 语句,根据 plzexit 的值退出子程序,但看起来该变量在退出 CMOV2 子程序时死亡。跨度>
-
将 CMOV2 更改为返回布尔值的函数。如果用户在 CMOV2 中取消,则返回 False,否则返回 True。在 CMOV 中,如果从 CMOV2 中返回“False”,则可以退出。