VBC09375 — Invalid length for fixed-length string
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
A fixed-length string is declared with a length it cannot have.
A String * n holds exactly n characters, and n is 1 to 65526. A length of 0, a negative one, or one past 65526 is no length a fixed-length
string can be, whether it is written as a number or given by a constant.
MS-VBA reports the same error, with the same message (recorded in Excel). A length written as a number past 65535, or as a number that is not whole
(String * 1.5), is VBC00001 Syntax error instead.
This code is raised where a module is compiled, for every String * n: of a variable, a local, an element of an array, a field of a Type, and the
As clause of a ReDim.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| A length of 0, or past 65526. | Dim code As String * 0, Dim page As String * 70000 |
Give the string the length it is to hold: Dim code As String * 4. For more than 65526 characters, use a String. |
| A constant that gives such a length. | Const Size = 0 … Dim code As String * Size |
Give the constant a length from 1 to 65526. |
See also
⏮️ VBC09374 Expected user-defined type, not project | ⏭️ VBC09376 Expected variable or procedure, not project
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca