Table of Contents

VBC09327 — ByVal argument not allowed here

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

Note

No longer raised. This code was the error of an argument written with the ByVal keyword in an argument list that is not that of an invocation of an external procedure, as MS-VBAL §5.6.13.1 Argument Lists has it. RD-VBA now compiles ByVal where MS-VBA does, and reports the error MS-VBA reports where it does not (RD-VBAL §5.6.13.1). The code keeps its number, which older builds report.

What a ByVal argument is now:

Situation Example What it is
An argument of a ByVal parameter, of any procedure. Twice(ByVal 2), for a Function Twice(ByVal n As Long) Valid, and changes nothing: RDC00310 says so.
An argument of a Declare's parameter, or of an As Any one. Sleep ByVal 0, VarPtr(ByVal p) Valid.
An argument of a ByRef parameter of the workspace or of a library. Foo ByVal x, for a Sub Foo(ByRef n As Long) VBC09310 Type mismatch.
An argument of an array parameter. Bump ByVal values, for a Sub Bump(a() As Long) VBC09371 Array argument must be ByRef.
An argument of a function MS-VBA compiles inline, or an index of an array. Len(ByVal s), arr(ByVal i) VBC00001 Syntax error.

RaiseEvent has no ByVal in its grammar at all (MS-VBAL §5.4.2.20): there the keyword is a syntax error (VBC00001), reported by the parser.

See also


⏮️ VBC09326 Invalid event handler | ⏭️ VBC09328 Invalid Implements directive


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