函数的例子
1、无参数,无返回值
sub Add1()
msgbox "无参数,无返回值的函数例子Add1"
end sub
2、有参数,无返回值
sub Add2(strInfo as string)
msgbox "传入的字符串参数是 " & strInfo & " ,无返回值的函数例子Add2"
end sub
3、有参数,有返回值(有返回值的函数定义使用Function)
function Add3(strInfo as string) as string
msgbox "传入的字符串参数是 " & strInfo & ""
Add3="你要返回的字符串 " & strInfo
end function
函数调用
sub command1_click()
call add1
call add2("参数2")
msgbox add3("参数3")
end sub