将函数作为另一个函数的参数传递
Sub transliterate()
somecode
...
...
...
return word(a,b)
End Sub
sub word(x,y)
end sub
答案 0 :(得分:0)
VBA不使用return
传回函数的结果。 VBA使用以下类型的构造,其中将结果分配给函数名称。达到End Function
后,将返回分配给函数名称的值。
Sub testTransliterate()
Dim a As String, b As String, Result As String
a = "one"
b = "two"
Result = transliterate(x(a), b)
Debug.Print Result
End Sub
Function x(a As String) As String
x = a & " test"
End Function
Function transliterate(x, y) As String
Dim Result As String
Result = y & ", " & x
transliterate = Result
End Function