<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="VB6Parse Library Reference - error - Runtime State">
<title>error - Runtime State - VB6Parse Library Reference</title>
<link rel="stylesheet" href="../../../assets/css/style.css">
<link rel="stylesheet" href="../../../assets/css/docs-style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
<script src="../../../assets/js/theme-switcher.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/vbnet.min.js"></script>
<script>hljs.highlightAll();</script>
</head>
<body>
<header class="docs-header">
<div class="container">
<h1><a href="../../../index.html">VB6Parse</a> / <a href="../../../library/index.html">Library</a> / <a href="../../../library/statements/runtime_state/index.html">Runtime State</a> / error</h1>
<p class="tagline">VB6 Library Reference</p>
</div>
</header>
<nav class="docs-nav">
<div class="container">
<a href="../../../index.html">Home</a>
<a href="../../../library/index.html">Library Reference</a>
<a href="../../../documentation.html">Documentation</a>
<a href="https://docs.rs/vb6parse" target="_blank">API Docs</a>
<a href="https://github.com/scriptandcompile/vb6parse" target="_blank">GitHub</a>
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
<span class="theme-icon">🌙</span>
</button>
</div>
</nav>
<main class="container">
<article class="library-item">
<p>VB6 Error statement syntax:
- Error errornumber
Generates a run-time error; can be used instead of the Err.Raise method.
The Error statement syntax has this part:</p>
<table>
<thead>
<tr>
<th>Part</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>errornumber</td>
<td>Required. Any valid error number.</td>
</tr>
</tbody>
</table>
<p>Remarks:
- The Error statement is supported for backward compatibility.
- In new code, use the Err object's Raise method to generate run-time errors.
- If errornumber is defined, the Error statement calls the error handler after the properties
of the Err object are assigned the following default values:
* Err.Number: The value specified as the argument to the Error statement
* Err.Source: The name of the current Visual Basic project
* Err.Description: String expression corresponding to the return value of the Error function
for the specified Number, if this string exists
Examples:</p>
<pre><code class="language-vbnet">Error 11 ' Generate "Division by zero" error
Error 53 ' Generate "File not found" error
Error vbObjectError + 1000 ' Generate custom error</code></pre>
<p><a href="https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/error-statement">Reference</a></p>
</article>
<div style="margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-color);">
<p>
<a href="index.html">← Back to Runtime State</a> |
<a href="../index.html">View all statements</a>
</p>
</div>
</main>
<footer>
<div class="container">
<p>© 2024-2026 VB6Parse Contributors. Licensed under the MIT License.</p>
</div>
</footer>
</body>
</html>