Skip to content

VBA250 — Fixed-length String at procedure level

Severity: 🔴 error Category: declaration Phase: 2.8

Description

Dim s As String * N is only legal at module / UDT level, not inside a procedure.

Failing example

Sub S()
    Dim s As String * 10
End Sub

Compliant example

Public name As String * 10
Sub S(): End Sub

How to fix

Move the declaration to module level, or use a regular As String.


Source: src/rules.py — entry VBA250.