Extensibility

The Extensibility library makes it possible to write VBA code that can control and manipulate the VBE environment and VBA projects.
This makes it possible to write code that can directly access code modules and Userforms.
It is possible to write code that will automatically indent your code or export your modules to text files.
VBA allows you to modify the VBA components and code modules dynamically as if you were going through the VBE interface.


What is the VBIDE ?

The VBIDE stands for the Visual Basic Integrated Design Environment.
This library is often referred to as the VBIDE object library
This allows you to write code in VBA that reads or modifies other VBA projects, modules, or procedures.


Microsoft Visual Basic for Applications Extensibility 5.3

The VBIDE is the object library that defines all the objects and values that make up VBProject and the Visual Basic Editor.
You must reference this library to use the VBA Extensibility objects.
The Extensibility library makes it possible to write VBA code that can control and manipulate the VBE environment and VBA projects.
This makes it possible to write code that can directly access code modules and Userforms.
It is possible to write code that will automatically indent your code or export your modules to text files.
VBA allows you to modify the VBA components and code modules dynamically as if you were going through the VBE interface.


Add a Reference

First, you need to set an reference to the VBA Extensibility library.
(Tools > References)
Find "Microsoft Visual Basic For Applications Extensibility 5.3" and tick it
C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\ Vbe6ext.olb


Enable Programmatic Access to the VBA Project

Switch to Excel, Options > Security > Macros > Trusted Publishers
Find "Trust access to the Visual Basic Project" and tick it


Project must be Unlocked

Your VB Project that you want to manipulate cannot be protected or locked.
There is no programmatic way to unlock a VBA project (other than using SendKeys which is not recommended).


Cannot Debug the Code

You are unable to step through code when making changes to the project (dynamically eg using InsertLine etc). the code can be run but not stepped through.
Changes have been made to the project using the extensibility (addin reference) model


Office 2007 Changes

In Office 2007, click the Developer item on the main Ribbon and then click the Macro Security item in the Code panel.
In that dialog, choose Macro Settings and check the Trust access to the VBA project object model.



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext