VBC00042 — Numeric literal overflow
Severity: Error · Family: VBC (parser / concrete syntax tree) ·
Source metadata: VBSyntaxErrorInfo
A numeric literal was written whose value does not fit the type the literal resolves to. The type is fixed by the literal's own form — a type-declaration suffix, the presence of a decimal point or exponent, or a radix prefix — before any context is considered, so the overflow is a property of the literal alone and is caught while the syntax tree is built. See RD-VBAL §3.2 Literal Expressions and MS-VBAL §3.3.2.
The verbose detail names the literal and the type it overflowed.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| A type-declaration suffix pins the literal to a type it cannot fit. | 99999% — % is Integer (max 32767) |
Drop the suffix, use a wider one (99999&), or reduce the value. |
An unsuffixed integer literal exceeds Long. |
3000000000 |
Add @ (Currency) or # (Double), or write it as a narrower value. |
| An unsuffixed floating-point literal (decimal point or exponent) overflows to infinity. | 1E400 |
Reduce the magnitude; Double tops out near 1.8E308. |
| A hexadecimal or octal literal without a suffix exceeds 32 bits. | &HFFFFFFFFF |
Add & to force Long semantics, or use fewer digits. |
Notes
This is a syntax error, not a runtime one: the literal is rejected before evaluation, regardless of
where it appears. A value that fits its literal type but not its assignment target is a separate,
later concern (a let-coercion / type-mismatch diagnostic), not VBC00042.
See also
⏮️ VBC00001 Syntax error | ⏭️ Diagnostics
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca