How to use

Quick start

  1. Run VBA Plug (file vbaplug.exe).
  2. In the "Read Office file" field, enter the Office file you wish to analyze. Alternatively, open the file in Office and select "Connect to running application".
  3. Press Export & Analyze.

VBA Plug will retrieve the VBA source, save it in a new directory and run Project Analyzer on it.

VBA Plug main window

How to analyze a VBA project

VBA Plug is a standalone program. It's not a VBA add-in (or plug-in). It does not install itself inside the VBA environment or as an Office menu item. You run the program by clicking the file vbaplug.exe.

After starting VBA Plug, you have 2 alternatives to retrieving your VBA code.

A. Read Office file. Pick up the required document file. VBA Plug opens it in Office and retrieves the VBA code in it. This is the quick and simple option. Unfortunately, this approach doesn't always work. It can fail due to security options, the complexity of the solution or the use of a startup dialog.

Include all referenced VBA projects. By selecting this checkbox you can export all the files referenced by the selected file. If you leave it unselected, only the selected file will be exported.

B. Connect to running application. Run an Office application and open the required documents in it. Switch to VBA Plug and let it connect to Office. VBA Plug will retrieve all open VBA projects. This approach lets you export several projects simultaneously. This is useful when your solution consists of several files that refer to each other. Connecting is also required when your security options disallow programmatic access to the VBA code, or when the VBA project is password protected and you need to supply the password before connecting. Connecting is also a solution when the project in question shows a modal dialog at startup.

Output directory

Here you select an empty directory for the exported code. You can either select a directory by yourself or let VBA Plug generate a new one automatically. The (Automatic new directory) option will create a new directory and export the files in it. It will not overwrite any existing files.

Location of automatic new directory. By default, the automatic new directory will be under the system's temporary directory. You can select another location with the Output directory command in the File menu. VBA Plug will create new sub-directories under the directory you specify via this dialog.

If you have written something in the Output directory field, you can reset it back to (Automatic new directory) by erasing the field's contents.

Export buttons

Export retrieves the code and saves it in the output directory. When the export is complete, you can run Project Analyzer and open the exported .vbp or .vbg file in it. You can find the file name in the generated log.

Export & Analyze retrieves the code and saves it. When complete, it runs Project Analyzer to analyze the exported code.


The Options menu allows you to control two compiler constants. This is useful if your code uses conditional compilation such as #If Win64 Then or #If Mac Then. If your code has neither you can ignore the Options menu.

Assume #Const Win64 = True
By default, Office VBA projects are analyzed as 32-bit code with Win32=True and Win64=False. If the code is intended for 64-bit Office and refers to the Win64 compiler constant, select this option.
Assume #Const Mac = True
By default, Office VBA projects are assumed to run on Windows and constant Mac=False. If the code is intended to run on the Mac and refers to the Mac compiler constant, select this option.

Generated files

VBA Plug exports each VBA module as a separate file. In addition, a .vbp project file represents each exported VBA project. When several projects are exported at the same time, a .vbg project group file represents all of them.

File typeDescription
.basStandard module
.clsClass module
.frmCode behind a UserForm
.vbadocCode behind a document module
.vbpVBA project
.vbgProject group (collection of .vbp's)

The generated files are similar to those of Visual Basic 6.0, although changes do exist. You cannot load the exported projects into VB6 as such since this is not a real VBA-to-VB converter. However, you can load them in Project Analyzer.

Multiple projects vs. single project

In many cases there are several VBA projects open at once. For example, in Word you can have a .doc document and the template. The document can call procedures in the template. VBA projects may also refer to other documents, which are loaded at the same time as the main document.

The connect approach automatically exports all the projects that are currently open in the application in question.

The read a file approach lets you select which projects to export. When you check the box "Include all referenced VBA projects", all the projects that are loaded with the main document file are exported. When you uncheck this box, only the project in the selected file is exported.

If you export several projects, several .vbp project files are created. Each .vbp represents a VBA project (one .vbp per original document file). A .vbg project group file is created that represents all the projects. To fully analyze the generated .vbg project group, you need multi-project analysis, which is a feature of Project Analyzer Enterprise Edition. If you don't have this edition, you can still analyze each .vbp project one at a time.


If opening a file fails, try again via the connect approach as described above.

Programmatic access to Visual Basic Project is not trusted

Your security options do not allow access to your VBA code. You can enable access by the following procedure in the appropriate Office application:

If this doesn't help, quit all running instances of the Office application. Open up the Windows Task Manager (press Ctrl+Alt+Del). Check the Processes list to verify there are no hidden instances of application running. Sometimes Excel.exe, Visio.exe etc. may stay running even after you close them. End the extra processes, rerun the application, set the Trust access option, then run VBA Plug again.

A password is required

Use the connect approach. First open the VBA code in Office and supply your password. Then run VBA Plug and connect to the running application.

VBA project projectname - Skipped

The project was not exported. It can happen in 2 cases:

  1. Multi-project analysis was not selected and only 1 project was exported.
  2. VBA Plug cannot retrieve the code, possibly because it's password protected. See above.

Host application not supported

VBA Plug does not support the application version installed on your computer. The version may be too new or too old.

Example: "Host application not supported: Microsoft Excel 5.0." In this case, your Excel version is too old and you need to use a newer version.


Error #429: ActiveX can't create object

The Office application required to open the selected document file is probably not installed correctly. You need to VBA Plug on a machine that has the respective Office application installed.

Error #462: The remote server machine does not exist or is unavailable

You may have disabled the DCOM Server Process Launcher service. Enable the service it via the Computer Management panel in Windows Administrative Tools. VBA Plug can run without the service, but a VBA Plug user reported that this trick solved error #462 on Windows XP with Office 2003.

No VBA project

Close VBA Plug and restart it. Retry. Office may sometimes return "No VBA project" even when there is a VBA project in the file. Restarting should fix the issue.

©Aivosto Oy - Project Analyzer Help Contents