VBC00057: An #Else clause must be preceded by an #If
Severity: Error · Family: VBC (parser / concrete syntax tree) ·
Source metadata: VBSyntaxErrorInfo
A #Else directive belongs to no #If block, or is the second #Else of its block.
A block has at most one #Else, after its #If and its #ElseIfs and before its #End If.
MS-VBA reports the same error, with the same message (recorded in Excel).
This code is raised by the parser, at the #Else.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
An #Else with no #If. |
Private Const A = 1 … #Else |
Write the #If the #Else belongs to, or remove it. |
A second #Else in a block. |
#If VBA7 Then … #Else … #Else … #End If |
Make the first #Else an #ElseIf with a condition, or remove one. |
See also
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca