Skip to content

VBA137 — User-defined type passed ByVal

Severity: 🔴 error Category: signature Phase: 2.10

Description

A user-defined Type parameter must be passed ByRef, not ByVal.

Failing example

Type T
    x As Long
End Type
Sub S(ByVal p As T)
End Sub

Compliant example

Type T
    x As Long
End Type
Sub S(ByRef p As T)
End Sub

How to fix

Change the parameter to ByRef (the default).


Source: src/rules.py — entry VBA137.