Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

傳回 Boolean 值,指出 運算式> 是否為錯誤值。

語法

IsError ( 表示 式)

必要 表達 式引數 可以是任何有效的表達式。

註解

錯誤值是使用 CVErr 函數將實數轉換為錯誤值所建立。 IsError 函數可用來判斷 數值運算式 是否代表錯誤。 如果表達式自變數指出錯誤,IsError 會傳回 True;否則,它會傳回 False

範例

附註: 下列範例示範如何在 Visual Basic for Applications (VBA) 模組中使用此函數。 如需使用 VBA 的詳細資訊,請在 [搜尋] 旁的下拉式清單中選取 [開發人員參考],並在 [搜尋] 方塊中輸入一個或多個字詞。

此範例使用 IsError 函數來檢查數值表達式是否為錯誤值。 CVErr 函數是用來傳回使用者定義函數的錯誤 Variant。 假設 UserFunction 是使用者定義的函數程式,會傳回錯誤值;例如,指派的傳回值與語句 UserFunction = CVErr(32767),其中 32767 是使用者定義的數位。

Dim ReturnVal, MyCheck
ReturnVal = UserFunction()
MyCheck = IsError(ReturnVal) ' Returns True.

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×