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
5
votes
2 answers

Determine if the VBE is open

I'm trying to develop an 'auto run' macro to determine if the VBE is open (not necessarily the window of focus, just open). If this is TRUE then ... take some action. If this macro is connected to a CommandButton it works but I can't get it to…
Jerry
  • 100
  • 2
  • 9
5
votes
1 answer

How to manage a local git repository using Rubberduck

I'm using Rubberduck (Version 2.0.13) in combination with a local git repository for version control of my VBA project. Currently, I need to re-open the repository every time I start Rubberduck using Manage -> Open Existing Repository in the Source…
Jörg Brenninkmeyer
  • 3,304
  • 2
  • 35
  • 50
5
votes
1 answer

Selection command changes to lower case in VBA

When my colleague writes a macro with the Selection reference in it, for some reason it changes the word Selection to a lower case s and stops it from working. Example: Selection.Copy changes to selection.Copy Could someone advise what is…
W Beck
  • 53
  • 4
5
votes
1 answer

Why does VBA editor opens Outlook?

Sometimes when I'm inspecting some variable on my excel macro, Outlook opens up by itself. This is pretty annoying since I don't even use Outlook nor have it configured. What is happening here? I'm using Office 2016. Edit: I don't think this has…
mathiasfk
  • 1,278
  • 1
  • 19
  • 38
5
votes
1 answer

ReplaceLine method in VBE only replacing part of line

In response to this question I thought it would be fun to write a VBE macro that would automatically replace lines which look like DimAll a, b, c, d As Integer by Dim a As Integer, b As Integer, c As Integer, d As Integer In my first draft I just…
John Coleman
  • 51,337
  • 7
  • 54
  • 119
4
votes
2 answers

Excel OLEObject button loses click event after clicking a few times

I was trying to create an Excel button in a sheet from a C# code, using a C# event hander for the button, so I don't have to involve VBA and text scripts; and I found this great solution from @ Dummy yoyo that works but "only for a while". The…
Daniel Möller
  • 84,878
  • 18
  • 192
  • 214
4
votes
2 answers

How can I find a word with a new line in the VBA editor using find and replace?

I would like to go through and find all of the "End" statements in my code but skipping all of the "End x" statements like "End If", "End Sub", "End function", etc.--Just the pure "End". My thought was to use pattern matching, but I am unsure of how…
ScottC
  • 41
  • 1
4
votes
1 answer

Change Visual Basic Editor settings programmatically (Font colors)

I am seeking for a way to change the VBE settings programmatically. More especially, the editor background / font colors that manually are controlled at the pop up window: VBE > Tools > Options > Editor Format
4
votes
3 answers

VBA - Find all numbered lines in VBE Modules via pattern search

Task: My goal is to find all numbered lines in procedures of my Code Modules. The CodeModule.Find method can be used to check for search terms (target parameter). Syntax: object.Find(target, startline, startcol, endline, endcol [, wholeword] [,…
T.M.
  • 9,436
  • 3
  • 33
  • 57
4
votes
2 answers

Can not see the add in after installing rubberduck?

I am new to rubberduck and have installed the latest version 2.0.11. After admin installed, I go to excel and check my com-addins and it does now show rubberduck there. I've check my programdata folder and yes, rubberduck is there with all files…
pokemon_Man
  • 902
  • 1
  • 9
  • 25
4
votes
2 answers

Automatically add `Option Private Module` to all modules in VBA

Is there a way automatically to add Option Private Module to all modules in VBA? Something like the automatic adding of Option explicit when we mark the checkbox in the Extras>Option>editor for declaration of variables? Because going through all…
Vityata
  • 42,633
  • 8
  • 55
  • 100
4
votes
4 answers

Can I get the text of the comments in the VBA code

Lets say I have the following: Public Sub Information() 'TEST End Sub Is there a way to get "TEST" as a result? Somehow through VBA? E.g. - In PHP there is a good way to take the comments. Any ideas here? Edit: There should be a way, because…
Vityata
  • 42,633
  • 8
  • 55
  • 100
4
votes
2 answers

Writing VBA procedure/function to an .xlam addin

I have created a VBA project in Excel and within said project is a module that writes code to another module. I eventually password protected the project so as to keep the code hidden (not realizing right away that this would pose some pretty…
Singularity20XX
  • 321
  • 5
  • 20
4
votes
2 answers

Method 'VBE' of object '_Application' failed

One of my clients has issue running the Excel VBA code below. He gets the following error Method 'VBE' of object '_Application' failed, but only once, after he opens the VBE, it starts to work. Also, it was working for him until yesterday. He is…
Jevgenius
  • 41
  • 1
  • 2
4
votes
1 answer

How do I get the *actual* host application instance?

I have this code in a C# add-in for the VBE (emphasis "VBE": it's not a MS-Office add-in): public abstract class HostApplicationBase : IHostApplication where TApplication : class { protected readonly TApplication Application; …
Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
1 2
3
14 15