'#Else' must be preceded by a matching '#If' or '#ElseIf'

#Else is a conditional compilation directive. An #Else directive is not preceded by a corresponding #If or #ElseIf directive.

Error ID: BC30028

To correct this error

  1. Check that a preceding #If or #ElseIf is not separated from this #Else by an intervening conditional compilation block or an incorrectly placed #End If.

  2. Check that #Else is preceded by another #Else directive. If it is, either remove #Else or change it to an #ElseIf.

  3. If everything else is in order, add an #If directive to the beginning of the conditional compilation block.

See Also

Reference

#If...Then...#Else Directives