ErrObject.GetException メソッド

定義

発生したエラーを表す例外を返します。

public:
 Exception ^ GetException();
public Exception GetException();
member this.GetException : unit -> Exception
Public Function GetException () As Exception

返品

発生したエラーを表す例外。

次のコードは、 Err オブジェクトの例外に割り当てられたメッセージを表示します。

On Error Resume Next
Dim myError As System.Exception
' Generate an overflow exception.
Err.Raise(6)
' Assigns the exception from the Err object to myError.
myError = Err.GetException()
' Displays the message associated with the exception.
MsgBox(myError.Message)

注釈

GetException関数は、Err オブジェクト クラスからのみ使用できます。 Err オブジェクトのException プロパティと連携して、発生したエラーを表示します。

適用対象

こちらもご覧ください