Name Property

Description

Used to name a class, module, or project. This property is only available at design time.

Rules at a Glance

  • Standard VB naming conventions apply.

  • VBA assigns default names (Project1, Class1, etc.) to classes and projects.

Programming Tips and Gotchas

  • You can't use the same name for a class and the project within which the class resides.

  • The Project name for an ActiveX project is used by OLE Automation as the Library name when creating or referring to an object. The object reference takes the form LibraryName.ClassName.

  • Since you typically refer to a class, form, or module by its name from outside of that object, it's best to replace the default value of the Name property (unless, of course, that's the name you intend to keep) as soon after adding it to your project as possible.

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.