您的位置:首页 > 编程语言 > VB

难点:VBScript 过程

2015-10-17 19:30 260 查看
1.Sub 过程

Sub过程是包含在Sub和End Sub语句之间的一组VBScript语句,执行操作但不返回值。Sub过程可以使用参数。

例子:

Option Explicit

SayHelloToBill

Sub SayHelloToBill

Dim strMsg

strMsg="Hello,Bill.Welcome to our script"

MsgBox strMsg

End Sub

2.Function 过程

Function过程是包含在Function和End Function语句之间的一组VBScript语句。Function过程与Sub过程类似,但是Function过程可以有返回值。Function过程可以使用参数。

例子:

Option Explicit

Dim temp,fDegrees

ConvertTemp

Sub ConvertTemp()

temp=InputBox("请输入华氏温度:",1)

MsgBox "温度为:"&Celsius(temp)&"摄氏度"

End Sub

Function Celsius(fDegrees)

Celsius=(fDegrees-32)*5/9

End Function
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: