帮我检查代码哪里错了,提示:无效外部过程

来源:百度知道 编辑:UC知道 时间:2024/05/26 19:59:33
Dim theStr
theStr = InputBox( "请输入要转换的密码:", "输入", "44,41,43,32,43,5,45,64,43,24,31,53,46,57,64,86" )
If theStr <> "" Then
Call InputBox("请复制已经转换好的密码",,zpass(theStr))
End If
Function zpass(pass)
tpass=""
MyArray = Split(pass, ",", -1, 1)
For each thepass in MyArray
if len(thepass) = 1 then
tpass=tpass+"0"
end if
tpass=tpass+hex(thepass)
Next
zpass=tpass
End Function

你这代码没什么问题啊,正确的啊!
下面是我调试通过了的,你复制回去看看:

Private Sub Command1_Click()
Dim theStr
theStr = InputBox("请输入要转换的密码:", "输入", "44,41,43,32,43,5,45,64,43,24,31,53,46,57,64,86")
If theStr <> "" Then
Call InputBox("请复制已经转换好的密码", , zpass(theStr))
End If
End Sub
Function zpass(pass)
tpass = ""
MyArray = Split(pass, ",", -1, 1)
For Each thepass In MyArray
If Len(thepass) = 1 Then
tpass = tpass + "0"
End If
tpass = tpass + Hex(thepass)
Next
zpass = tpass
End Function

'关键是你前面的代码没有放在过程内。
'这样改就好:
Function zpass(pass)
tpass = ""
MyArray = Split(pass, ",", -1, 1)
For Each thepass In MyArray
If Len(thepass) = 1 Then
tpass = tpass + "0"
End If
tpass = tpass + Hex(thepass)
Next
zpass = tpass
End Function

Private