我正在尝试编写一个子语句,它接收来自另一个调用它的子句的多个参数(道歉,我对此很新 - 所以我的术语可能不会被发现).
我传递的参数数量相当多,因此它从我的屏幕延伸出来.为了便于阅读,我想将参数列表分成多行.我试图像你在内部使用"空间下划线"技巧sub.然而,当我这样做时,VBA停止认识到sub它自己的常规.
我有什么想法可以做到这一点?
例如,这工作:
...
End Sub ' from previous subroutine
Sub openfile(ByVal Res, ByVal Book, ByVal inp) 'there are other arguments as well, but I have shortened them for convenience here.
....
End Sub
Run Code Online (Sandbox Code Playgroud)
但这不是:
...
End sub ' from previous subroutine
Sub openfile(ByVal Res, ByVal Book, _
ByVal inp) 'there are other arguments as well, but I have shortened them for convenience here.
....
End Sub
Run Code Online (Sandbox Code Playgroud)
在代码的下一部分之间不能有完全空行(空行)_.删除额外的行,你会没事的.基本上,这样做:
Sub openfile(ByVal Res, ByVal Book, _
ByVal inp) 'there are other arguments as well, but I have shortened them for convenience here.
Run Code Online (Sandbox Code Playgroud)
如果你真的想要一个几乎空白的行,你可以这样做:
Sub openfile(ByVal Res, ByVal Book, _
_
ByVal inp) 'there are other arguments as well, but I have shortened them for convenience here.
Run Code Online (Sandbox Code Playgroud)
请注意,_它在自己的行上必须有一个空格字符; 这很重要.