Application.VBE
This gives you programmatic access to the Visual Basic Editor object model that represents projects, modules, procedures, and the editor environment.
It's part of the VBA Extensibility library and is used when you want to inspect, create, modify, or delete VBA code at runtime.
This property returns a VBE object, which is the root of the Visual Basic Editor automation model.
VBProjects - every VBA project loaded in the host application
VBComponents - modules, class modules, userforms
CodeModule - the actual lines of code
Windows - VBE windows (Project Explorer, Code Pane, etc.)
VBE Object
This is the top level object of the Visual Basic Editor
The VBE refers to the Visual Basic Editor, which includes all the windows and projects that make up the editor.
Dim obVBAEditor As VBIDE.VBE
Set obVBAEditor = Application.VBE
VBProject
A VBProject corresponds to one of the top level items in the Project Explorer
A VBProject contains all the code modules and components of a single workbook.
One workbook has exactly one VBProject. The VBProject is made up of 1 or more VBComponent objects.
You can also iterate through the VBProjects collection
Dim obVBProject As VBIDE.VBProject
Set obVBProject = Application.VBE.VBProjects(2)
Set obVBProject = Workbooks(1).VBProject
When programming the VB Editor it is very useful to know which project is currently highlighted in the Project Explorer
This is given by the ActiveVBProject property
Dim obVBP AS VBIDE.VBProject
Set objVBP = Application.VBE.ActiveVBProject
Note that this project is the project the user is currently editing in the VB Editor and is not related to the active workbook or document
VBComponent
A VBComponent is one object within the VBProject.
A VBComponent is a code module, a UserForm, a class module, one of the Sheet modules, or the ThisWorkbook module.
A VBComponent is of one of the following types, identified by the Type property. The following constants are used to identify the Type.
The numeric value of each Enumeration Constant is shown in parentheses.
vbext_ct_ClassModule (2): A class module to create your own objects.
vbext_ct_Document (100): One of the Sheet modules or the ThisWorkbook module.
vbext_ct_MSForm (3): A UserForm. The visual component of a UserForm in the VBA Editor is called a designer.
vbext_ct_StdModule (1): A regular code module. Most of the procedures on this page will work with these types of components.
Dim objVBComponent As VBIDE.VBComponent
Set objVBComponent = ActiveWorkbook.VBProject.VBComponents("Module1")
Set objVBComponent = objVBProject.VBComponents("Module1")
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext