Questions tagged [vbe]

Visual Basic Editor is the built in IDE for writing VBA. It is hosted by various MS Office programs. Use this tag for general questions about the IDE or the Microsoft VBA Extensibility Library (VBIDE) which allows automation of the Visual Basic for Applications Editor.

Visual Basic Editor is the built in IDE for writing VBA. It is hosted by various MS Office programs. Use this tag for general questions about the IDE or the Microsoft VBA Extensibility Library (VBIDE) which allows automation of the Visual Basic for Applications Editor.

VBE has three key elements: Code window (on the right); Projects window (top left), and Properties window (bottom left). Example for Excel:

VBE example

Others may be added, for example for Watches.

217 questions
65
votes
8 answers

Alternative IDE for VB6 and VBA

I've been spoiled by Visual Studio 2008 and Eclipse and have to do a little maintenance work on a Visual Basic 6.0 (VB6) application. Is there an alternative/ updated IDE for Visual Basic 6.0? A rewrite is not an option. I'm just fixing a couple of…
Omar Kooheji
  • 54,530
  • 68
  • 182
  • 238
23
votes
3 answers

How can I run a macro from a VBE add-in, without Application.Run?

I'm writing a COM add-in for the VBE, and one of the core features involves executing existing VBA code upon clicking a commandbar button. The code is unit testing code written by the user, in a standard (.bas) module that looks something like…
Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
22
votes
7 answers

Why does the VBA Editor open on its own sometimes?

I created a script in Outlook 2003 VBA that watches for new appointments, and sets them to tentative and no reminder as I create them. I find that seemingly at random, the VBA editor will open itself. It doesn't happen when I use the new script,…
Kevin Finn
20
votes
2 answers

Is there a way in VBA to know about variables that aren't being used?

Is there a tool, method or setting in the standard VBA Editor to warn about variables that have been Dim'med, but aren't being used?
Lance Roberts
  • 22,383
  • 32
  • 112
  • 130
18
votes
4 answers

How to programmatically change conditional compilation properties of a VBA project

I'm currently working on a VBA code generator/injector that adds VBA functionality to Excel workbooks by using the VBA Extensibility. This all works fine. However, the original code that is injected uses conditional compilation, referring to some…
Peter Albert
  • 16,917
  • 5
  • 64
  • 88
18
votes
4 answers

Use Python to Inject Macros into Spreadsheets

I've got a macro that I'd like a bunch of existing spreadsheets to use. The only problem is that there are so many spreadsheets that it would be too time consuming to do it by hand! I've written a Python script to access the needed files using…
John Smith
  • 185
  • 1
  • 1
  • 6
16
votes
1 answer

Rubberduck UI submenus are disabled

I've just installed the Rubberduck VBE add-in v2.0.11.2453 (MSIL) on Windows 10 OS. When I open a macro-enabled Excel workbook in Excel and launch the VBA editor, Rubberduck starts but all commands under the Rubberduck menu are disabled. What am I…
Jean-Marc Flamand
  • 939
  • 3
  • 10
  • 24
16
votes
4 answers

Copy VBA code from a Sheet in one workbook to another?

I've been using the lines below to compy VBA modules from one workbook to another and I don't know if there is an easier way, but they have been working fine: Set srcVba = srcWbk.VBProject Set srcModule =…
user1283776
  • 19,640
  • 49
  • 136
  • 276
14
votes
12 answers

How to restore VBA Editor to its initial settings?

How to restore the VBA Editor to its intial settings ? I have some troubles with macro and projects explorer windows settings, after some bad manipulations.
13
votes
5 answers

Build add-in for VBA IDE using VB.NET

I have asked this elsewhere, but have never found anyone knows how to build an add-in for VBA IDE using VB.NET. Is it even possible? Could someone point me to an example?
Oorang
  • 6,630
  • 1
  • 35
  • 52
12
votes
3 answers

Excel crash when typing open parenthesis

Here's one I don't understand. Given this class module (stripped down to the bare minimum necessary to reproduce the crash): VERSION 1.0 CLASS BEGIN MultiUse = -1 'True END Attribute VB_Name = "TestCrashClass" Attribute VB_GlobalNameSpace =…
Patrick Wynne
  • 1,864
  • 15
  • 20
11
votes
2 answers

Why does this code compile when pasted in but fail otherwise?

A friend made me look at this page, and noticed a strange piece of code in the signature of one of the forum users. The code is a one-liner that goes as follows: On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To…
Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
9
votes
1 answer

Export VBA Editor (VBE) settings

I've made a lot of changes to the VBA editor on my PC, including customization of toolbars. Is there a way to export these so that I can use them on a different system, without having to start from the scratch?
user4066647
8
votes
1 answer

Add userform to a different workbook at runtime

I have an addin and a workbook open. The addin is a .xlam file and in the workbook I've added a reference to it. The addin is password protected. It is possible to run public methods of the addin from my workbook. However one method in the addin…
Greedo
  • 4,967
  • 2
  • 30
  • 78
8
votes
1 answer

Using Rubberduck unit tests, how can I find out which one of multiple asserts failed?

I'm using Rubberduck to unit test my VBA implementations. When using multiple Asserts of the same kind (e.g. Assert.IsTrue) in one TestMethod, the test result is not telling me which of them failed, as far as I can see. Is there a way to find out…
Jörg Brenninkmeyer
  • 3,304
  • 2
  • 35
  • 50
1
2 3
14 15