在VBA中是否有相当于Python的pass语句?

use*_*207 3 excel vba excel-vba excel-2016

我想知道在VBA中是否有相当于Python的pass语句.

我正在使用Excel 2016.

Yow*_*E3K 6

如果你正在寻找一些可以用来插入断点的"非语句",那么使用Stop(参见这个答案)似乎是最好的办法,因为该Stop命令会导致代码在到达时中断,即你甚至不需要将它标记为断点,因为它一个断点.

您可能还想考虑使用Debug.Assert some_logical_expression,它会在逻辑表达式求值时自动中断False.所以Debug.Assert False相当于Stop,并且Debug.Assert x = 3相当于If x <> 3 Then Stop.


Vit*_*ata 5

在 Python 中,您需要Pass,因为否则这些方法将不会运行。在 VBA 中,如果您保留一个空方法,如下所示:

Public Function Foo() As String()
End Function
Run Code Online (Sandbox Code Playgroud)