VBC09342 — Wrong number of arguments or invalid property assignment
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
A procedure is called with arguments it does not declare.
The call gives more arguments than the procedure declares parameters, or names an argument when the procedure declares none.
MS-VBA reports the same error, with the same message (recorded in Excel).
This code is raised by ObjectValueStaticSemantics.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| Too many arguments. | c.Increment 1 of a Sub Increment() |
Remove the extra arguments, or declare the parameters. |
| An argument for a property that takes none. | Debug.Print c.Count(1) of a Count that returns a Long |
Read the property without arguments. |
Notes
A Function or Property Get that declares no parameters and returns a Variant, an array or an object is not given the arguments: they index what it returns (Letters(1)). Through an object declared As Object or Variant, the call compiles, and raises error 450 when it runs.
See also
- RD-VBAL §5.6.13 Index Expressions
- RD-VBAL §5.3.1.11 Procedure Invocation Argument Processing
- RD-VBAL §2.6.2 Semantic Compilation Errors
⏮️ VBC09341 Can't assign to read-only property | ⏭️ VBC09343 LSet allowed only on strings and user-defined types
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca