Private Function test(ByVal lngTest1 As Long) As Long Dim lngTest2 As Long
lngTest2 = 200 test = lngTest2 + lngTest1End FunctionPublic Sub main() Dim lngTest As Long
lngTest = 100 lngTest = test(lngTest)
MsgBox lngTest
End Sub
Public Function formatk(ByVal str As String) As String Dim string1 As String Dim i As Integer string1 = Space(4) & str string1 = Right(string1, 4) formatk = string1 End Function
'下面的用户自定义函数返回 '它的参数的平方根。 Function CalculateSquareRoot(NumberArg As Double) As Double If NumberArg < 0 Then '评估参数。 Exit Function '退出调用过程。 Else CalculateSquareRoot = Sqr(NumberArg) '返回平方根。 End If End Function
Public Function aaaa(Byref strTest As String) As boolean strTest ="aaaaaaaaaaaaa" aaaa=true 'Return two value end function
Public Function ExistVendor(ByVal strcnn As String, ByVal dict As Dictionary) As Boolean Dim rs As New ADODB.Recordset Dim strsql As String rs.CursorLocation = adUseClient strsql = "select * from Cs where cslb='" & dict("cslb") & "' and Cs_Name='" & dict("Cs_Name") & "'" rs.Open strsql, strcnn If rs.EOF Then ExistVendor = False Else ExistVendor = True End If End Function
Public Function AD_HEX(ByVal AD As String) As Variant Const VAD = 4095 Const C = 5 If Val(AD) > 0 And Val(AD) < 5 Then AD_HEX = VAD / C * Abs(Val(AD)) Else AD_HEX = AD MsgBox "过载!", vbOKOnly + vbExclamation, "警告" End If End Function
Dim lngTest2 As Long
lngTest2 = 200
test = lngTest2 + lngTest1End FunctionPublic Sub main()
Dim lngTest As Long
lngTest = 100
lngTest = test(lngTest)
MsgBox lngTest
End Sub
Dim string1 As String
Dim i As Integer
string1 = Space(4) & str
string1 = Right(string1, 4)
formatk = string1
End Function
'它的参数的平方根。
Function CalculateSquareRoot(NumberArg As Double) As Double
If NumberArg < 0 Then '评估参数。
Exit Function '退出调用过程。
Else
CalculateSquareRoot = Sqr(NumberArg) '返回平方根。
End If
End Function
strTest ="aaaaaaaaaaaaa"
aaaa=true
'Return two value
end function
Dim rs As New ADODB.Recordset
Dim strsql As String
rs.CursorLocation = adUseClient
strsql = "select * from Cs where cslb='" & dict("cslb") & "' and Cs_Name='" & dict("Cs_Name") & "'"
rs.Open strsql, strcnn
If rs.EOF Then
ExistVendor = False
Else
ExistVendor = True
End If
End Function
Const VAD = 4095
Const C = 5
If Val(AD) > 0 And Val(AD) < 5 Then
AD_HEX = VAD / C * Abs(Val(AD))
Else
AD_HEX = AD
MsgBox "过载!", vbOKOnly + vbExclamation, "警告"
End If
End Function