Table of Contents

RDC11037: Non-breaking space in a name

Severity: Warning  ·  Family: RDC (Rubberduck Core analyzers)  ·  Raised by: NonBreakingSpaceInNameAnalyzer

A declared name has a non-breaking space (U+00A0) in it.

A non-breaking space looks like an ordinary space, so the name reads as two words. MS-VBAL has no identifier with such a character in it (MS-VBAL §3.3.5). MS-VBA compiles it as part of the name, and so does RD-VBA. The same name typed with an ordinary space is not the same name, or not a name at all.

Code copied from a web page often has such spaces.

The names are those of the module, as its VB_Name attribute writes it, and of its variables, constants, procedures, parameters and line labels. The finding is the name (for the module, its VB_Name attribute); the message shows the name with an ordinary space.

How it is raised

Situation Example Resolution
A name with a non-breaking space between two of its letters. Dim my Value As Long, the space a U+00A0 Remove the space, or retype it as part of a name with no space (myValue).
A module whose name has a non-breaking space. Attribute VB_Name = "Main Module", the space a U+00A0 Rename the module with no space (MainModule).

See also


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca