Table of Contents

VBC09352 — Overflow

Severity: Error  ·  Family: VBC (static semantics / abstract syntax tree)  ·  Source metadata: VBCompileErrorInfo

The value of a constant does not fit its type.

A constant is evaluated before the code runs, and a value that does not fit the type it is declared as - or the type its operations give it - is refused then, where a variable would raise error 6 when the code runs.

MS-VBA reports the same error, with the same message (recorded in Excel).

This code is raised by the host, when it evaluates the constants of a module it loads.

How it is raised

Situation Example Resolution
A value too large for the declared type. Const k As Integer = 99999 Declare the constant as a wider type (Long).
An operation that overflows. Const k As Long = 2147483647 + 1 Declare the constant as a wider type, and write its operands as that type.

See also


⏮️ VBC09351 Invalid data type for constant | ⏭️ VBC09353 Division by zero


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca