Skip to content

VBA190 — Conditional directive without matching #If

Severity: 🔴 error Category: preprocessor Phase: 3.8

Description

#Else, #ElseIf and #End If must be preceded by a matching #If. A directive with no open #If is a compile error.

Failing example

#Else
    x = 1
#End If

Compliant example

#If Win64 Then
    x = 1
#Else
    x = 2
#End If

How to fix

Add the opening #If … Then, or remove the orphan directive.


Source: src/rules.py — entry VBA190.