Customizing Projects using the Project Properties Dialog Box

Photo by Scott Webb on Unsplash
Every developer has IDE preferences for an efficient workflow. Here, we explore VBA project customization with the Project Properties dialog box.

In this article:

5 minutes read

In the Visual Tour of Excel’s Coding Dojo series, we delved into the VBA editor’s menus, toolbars, and windows. If you found the glut of tools daunting, you’re not alone. Indeed, I did too. But, you’ll develop preferences that suit your workflow soon enough. Fortunately, the editor robustly supports customization. In fact, many of these ease the adoption of coding best practices. In this article, we explore the VBA editor customization that the Project Properties dialog box avails.

Typically, any VBA editor customization done in Excel affects other Office applications on your computer. However, the settings you assign in the Project Properties dialog box only apply to the current VBA project.

On a side note, this article is one in a series of three on VBA editor customization. Listed below, for easy reference, are links to the other posts in the series:

Accessing the Project Properties Dialog Box

You should set project properties, such as name and description, at the start of every VBA project. Doing this at the outset is ideal, but the editor also lets you set or edit project properties at any other time. You do this using the editor’s Project Properties dialog box.

Different ways of displaying the Project Properties dialog box
Different ways of displaying the Project Properties dialog box
  • Select the project in the Project Explorer (unless only one project is open);
  • Open the Tools menu and choose VBAProject – Project Properties command (i.e., path 1-2). If the project already has a name, that name replaces “VBAProject” in the title of the command.
  • Alternatively, right-click anywhere on the Project Explorer. Then, select VBAProject – Project Properties from the pop-up context menu (i.e., path 1-3).
  • Otherwise, use the “Alt + T + E” key combination.

The Project Properties dialog box’s General tab

The General tab of the Project Properties dialog box lets you set or edit several aspects of your VBA project.

The Project Properties dialog box’s General tab
The Project Properties dialog box’s General tab

Project Name

Project Name which distinguishes projects in the Windows Registry and Object Browser. Your projects’ names should be distinct to avoid mix-ups.

Names are at most 40 alphanumeric characters long (i.e., letters, numbers, and underscores). Moreover, they must begin with an alphabet.

Project names also serve as class-name qualifiers and type library names (TypeLib). A TypeLib holds the descriptions of a project’s objects (modules and UserForms).

At times, you need the fully qualified class name to identify a class you created in a project. The fully qualified class name is the combination of the project and class names.

Project Description

Project Description is a brief and informative summary of the project’s purpose. It is displayed in the Object Browser’s Description Pane.

Help File Name

Help File Name is the name of a Help file, with a .hlp” or “.chm” extension, authored for a VBA project. It must include the full path of the file (e.g., C:\Docs\VBAProjs\Ex\SampleHelp.chm).

Instead of typing in a name, you can click the ellipsis button (next to the textbox) to select a Help file from a dialog box. Moreover, a project can only have one Help file.

Lastly, the Help file is usually displayed using the Application object’s Help method. You would typically assign this method to a button controls, menu items, or toolbar icons.

Project Help Context ID

Project Help Context ID is a number mapped to the Help file topic that displays (by default) on opening the file. Leaving this blank (i.e., context ID of ‘0’) means the Help file’s topmost topic shows by default.

Conditional Compilation Arguments

Conditional Compilation Arguments are global constants used only with the #If-Then-#Else directive to compile code-blocks selectively. Moreover, these constants are named items, accessible throughout the project. Furthermore, their value does not change during execution.

Creating applications that run across several Excel versions and differentiating debug and release versions of projects are two examples where you’ll need selective code compilation.

The Project Properties dialog box’s Protection tab

The Protection tab lets you prevent viewing and editing of VBA projects (i.e., its code, UserForms, and properties). However, UserForms or VBA code must be present in the VBA project for the protection to work.

The Project Properties dialog box’s Protection tab
The Project Properties dialog box’s Protection tab

To protect a VBA project:

  • Check the Lock project for viewing checkbox;
  • Enter a memorable access password and re-enter the password to confirm it;
  • Click the OK button;
  • Save and close the project.

Viewing and editing of the project have now been barred without the assigned password.

The Long and Short of It

Like most developers, you’ll want to set up your VBA editor in a manner that best suits your style or workflow. Excel supports a plethora of VBA Editor customizations to help you do just that. In this article, you’ve explored the VBA editor’s Project Properties dialog box and the many VBA editor customizations it avails you.

This article is one in a series of three on VBA editor customization. Listed below, for easy reference, are the links to the other posts in the series:

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Keep Learning

Related Articles

Keep Learning

Related Articles