Vba 出现错误时,强制函数返回
我有一个返回字符串的函数Vba 出现错误时,强制函数返回,vba,Vba,我有一个返回字符串的函数 在出现错误时,我希望它返回一个特定的值。如何执行此操作?如果发生错误,请使用On Error GoTo分支到特定标签: Function YourFunction() { On Error GoTo ErrorLabel ... your code ... Exit Function ErrorLabel: YourFunction = yourspecificvalue } 如果发生错误,请使用“错误转到时的”分支到特定标签: Functio
在出现错误时,我希望它返回一个特定的值。如何执行此操作?如果发生错误,请使用
On Error GoTo
分支到特定标签:
Function YourFunction() {
On Error GoTo ErrorLabel
... your code ...
Exit Function
ErrorLabel:
YourFunction = yourspecificvalue
}
如果发生错误,请使用“错误转到时的
”
分支到特定标签:
Function YourFunction() {
On Error GoTo ErrorLabel
... your code ...
Exit Function
ErrorLabel:
YourFunction = yourspecificvalue
}