Table of Contents

VBC09364 — Expected Sub, Function, or Property

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

A call statement names a variable or a constant of the procedure it is in, not a procedure.

A call statement invokes a procedure, with Call or without: what it names is a Sub, a Function or a Property - not a variable, whatever it holds. A variable or a constant of a module is VBC09370 Expected procedure, not variable instead. Without Call, a variable that holds an object is not this error: the statement calls the object's default member.

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

This code is raised where the statements of a procedure are checked, at the name the Call statement is written with.

How it is raised

Situation Example Resolution
A variable called. Dim x As Long … Call x Call the procedure meant, or remove the Call statement.
A variable called without Call, or written alone. Dim x As Long … x (1), x Call the procedure meant, or assign the variable: x = 1.
A variable that hides a procedure of the same name. Dim p As LongPtr in a module with a Sub P … P (1) Rename the variable: in the procedure that declares it, its name is the variable's.
A constant, a parameter, an array, a Variant or a record called. Const c As Long = 1 … c (1) Use the value in an expression.

See also


⏮️ VBC09363 Expected variable or procedure, not module | ⏭️ VBC09365 Range has no values


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