单选题
要想在过程Proc调用后返回形参x和y的变化结果,下列定义语句中正确的是
A、
Sub Proc(x as Integer, y as Integer)
B、
Sub Proc(ByVal x as Integer, y as Integer)
C、
Sub Proc(x as Integer, ByVal y as Integer)
D、
Sub Proc(ByVal x as Integer, ByVal y as Integer)
【正确答案】
A
【答案解析】
[解析] 本题考查VBA中参数传递的知识。在VBA的过程调用时,参数有两种传递方式:传址传递和传值传递。如果在过程声明时形参用ByVal声明,说明此参数为传值调用;若用ByRef声明,说明此参数为传址调用;没有说明传递类型,则默认为传址传递。即形参的结果会传递给实参。
提交答案
关闭