# Err
{: .no_toc }

Returns or sets the [**ErrObject**](/tB/Modules/ErrObject/index.md) describing the current run-time error state.

Syntax:
- **Err** [ **()** ]
- **Err** **=** *errorNumber*

*errorNumber*
: A **Long** error code to assign to the **Err** object. This is shorthand for `Err.Number = errorNumber`, since [**Number**](/tB/Modules/ErrObject/Number.md) is the default property of **ErrObject**.

The **Err** object is intrinsic and global --- there is no need to declare or construct one. Its properties are populated when a run-time error is raised, and reset to zero or zero-length strings when the active error handler exits via **Resume**, **Resume Next**, or any **Exit** statement, or when [**Err.Clear**](/tB/Modules/ErrObject/Clear.md) is called explicitly.

To generate a run-time error from user code, use the [**Raise**](/tB/Modules/ErrObject/Raise.md) method rather than the **Error** statement, especially for class-module and Automation errors.

### Example

This example uses the [**Number**](/tB/Modules/ErrObject/Number.md), [**Description**](/tB/Modules/ErrObject/Description.md), [**HelpContext**](/tB/Modules/ErrObject/HelpContext.md), [**HelpFile**](/tB/Modules/ErrObject/HelpFile.md), and [**Source**](/tB/Modules/ErrObject/Source.md) properties of the **Err** object to construct an error-message dialog.

```tb check_build
Dim Msg As String
On Error Resume Next       ' Defer error handling.
Err.Clear
Err.Raise 6                ' Generate an "Overflow" error.
If Err.Number <> 0 Then
    Msg = "Error # " & Err.Number & " was generated by " _
        & Err.Source & vbCrLf & vbCrLf & Err.Description
    MsgBox Msg, vbMsgBoxHelpButton, "Error", Err.HelpFile, Err.HelpContext
End If
```

### See Also

- [ErrObject](/tB/Modules/ErrObject/index.md) module
- [Erl](/tB/Modules/Information/Erl.md) function
- [On Error](/tB/Core/On-Error.md) statement
