VBA_Excel_教程:过程,函数
2016-12-03 11:11
357 查看
Sub s1() Debug.Print "s1" '调用过程:无括号,加call提升可读性 s2 Call s2 End Sub Sub s2() Debug.Print "s2" End Sub
函数当过程用完全没有问题
Function f1() Debug.Print "f1" f2 Call f2 End Function Function f2() Debug.Print "f2" End Function
函数是可以有返回值的
Function f1() Debug.Print "f1" strRet = f2("B") Debug.Print strRet strRet = f3("C") Debug.Print strRet End Function Function f2(inPara As String) As String '函数返回值用【函数名】表示 f2 = "return f2 " & inPara End Function Function f3(inPara) '返回值、参数:加类型声明更安全,提升可读性 f3 = "return f3 " & inPara End Function
相关文章推荐
- VBA_Excel_教程:分枝循环结构
- VBA_Excel_教程:表,格
- VBA_Excel_教程:变量,数组
- VB聊天工具:借助服务器端实现P2P通信
- VB 生成exe后,动态加载窗体的show事件会出现运行时错误5的解决方法
- vb winsock udp循环绑定端口直到成功
- VB中On Error Resume Next 什么意思,一般在什么情况下使用
- 全面概述VB.NET文件处理函数kill语句
- VB SetAttr 设置文件属性语句功能详解:
- 浅谈视场图像帧清晰度以及清晰度曲线
- VB6.0中Dir()函数的使用方法
- VB中的trim()函数
- VB程序VB代码:摄像头视频图像的监控,截图,录像(改进)
- VB调用摄像头录像,拍照,保存
- vb:将窗体嵌入桌面的一段代码
- VB创建多线程
- VB创建可以输出函数的DLL
- VB 如何把一个listbox作为参数传递
- 用Excel VBA代码实现去重录入某字段内容
- (一)宏与VBA