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
8
votes
1 answer

How do I know that `ThisWorkbook` is a `Workbook`?

I'm working with the VBIDE API, and can't assume that the host application is Excel, or any Office app either. So all I know is that I'm looking at a VBComponent, and that its Type is vbext_ct_document. In the VBE's immediate pane I can get this…
Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
8
votes
2 answers

Get the VBProject of a Database

Given a database object in MS Access VBA, how can one get that database's VBProject? Function GetVBProject(ByVal db As Database) As VBProject Set GetVBProject = ??? End Function The only way I know how to get VBProjects in Access is through…
cheezsteak
  • 2,731
  • 4
  • 26
  • 41
8
votes
1 answer

How to properly rename CodeModule of ThisWorksheet

I'm trying to rename the ThisWorkbook code module of an Excel worksheet using VBA Extensibility. I accomplish this with the line ThisWorkbook.VBProject.VBComponents("ThisWorkbook").Name = "wb" I can see the change in the VB editor and also access…
Peter Albert
  • 16,917
  • 5
  • 64
  • 88
8
votes
2 answers

VBA - IE GetElementByID not working

I'm having some trouble with entering a text in a search box when after I what I think to be the correcet ID tag is. I got the ID from the page's source code. I've done this before with other websites. Can someone please help me out? Is there…
Andy Caster
  • 81
  • 1
  • 1
  • 2
8
votes
9 answers

Stepping through code with F8 suddenly executes all code

I wrote code in an Excel 2010 environment and am trying to step through the code in the same. After a few lines, the rest of the code is immediately executed. If I set a breakpoint it will stop. Sometimes, I can then step through a few more lines…
rohrl77
  • 3,277
  • 11
  • 47
  • 73
7
votes
6 answers

How to disable auto backspace in Excel VBA editor

When typing in the editor it puts me back on the end of the last word. For example, I want Sub Entername() If I'm not typing quickly enough it goes: SubEnterName(). How do I turn this off.
user1050105
7
votes
1 answer

What's the difference between CommandBarEvents.Click and CommandBarButton.Click in VBE?

The VBA and VB6 Add-In Object Models (VBIDE) expose a CommandBarEvents object that have a Click event, and the event signature is: Dim WithEvents CmdBarEvents As CommandBarEvents Private Sub CmdBarEvents_Click(ByVal CommandBarControl As Object,…
ThunderFrame
  • 9,352
  • 2
  • 29
  • 60
7
votes
1 answer

Where are the VBProjectsEvents?

Using Microsoft.Vbe.Interop in C#, I can access CommandBarEvents and ReferencesEvents via VBE.Events. However the ever-so helpful MSDN documentation seems to indicate that there's a VBProjectsEvents that I could use to notify my add-in when a…
Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
6
votes
8 answers

Corrupt VBA Project Module Not Found Error

I have a workbook that was saved yesterday afternoon, and was working perfectly. I have opened it this morning, and none of the modules in the VBE are 'found'. Visually I can see them all sitting there. When trying to open any of these modules to…
Dean
  • 2,326
  • 3
  • 13
  • 32
6
votes
1 answer

ThisWorkbook.ChangeFileAccess xlReadWrite Creates Multiple VBAProjects for workbook in VBA Window

My workbook has the following open event: Private Sub Workbook_Open() ThisWorkbook.ChangeFileAccess xlReadOnly End Sub And then this button: Sub UnlockDeveloper() Dim pwd As String pwd = InputBox("Enter developer password:", "Password") If…
Stef Joynson
  • 222
  • 3
  • 10
6
votes
1 answer

*.xlam add-in and missing references in a new VBA project / new Excel's instance with the add-in turned on

Repro: Start Excel and open VBE ALT+F11. Find Tools and click References. Scroll down til you find Microsoft Scripting Runtime and tick it. Save the file as Addin.xlam in the default location which should be something…
user2140173
5
votes
1 answer

Possible to Create 64-bit Add-in for VBA IDE using IDTExtensibility2?

Is it possible to create a COM add-in that will load into the Visual Basic Editor of Office 2010 64-bit? I can get my add-in to load into Office 2010 32-bit, but it just gets ignored by the 64 bit version. EDIT: In my research, I am finding that a…
Chris Spicer
  • 2,144
  • 1
  • 13
  • 22
5
votes
0 answers

Corrupted sheet objects

I noticed a strange behavior with Excel VBA. The Project window shows some orphaned sheet objects (e.g. "Sheet16") that cannot be deleted and don't belong to valid worksheets. Looking at these orphans, I can see that they contain callback functions…
5
votes
7 answers

Changing language of Visual Basic Editor to English

After Microsoft Office updated to the 2016 version I found the VBA interface is in German. How can I restore it to English? My Windows 10 settings are set to English and the local setting preferences are all for English UK as well (dates, decimals…
Cezary Domański
  • 71
  • 2
  • 2
  • 4
5
votes
1 answer

How to query the mode of the VB6 IDE from C#

I'm a contributer to the open source project Rubberduck, and looking to add support for the standalone VB6 IDE (it currently supports VBA). One piece of information we need from the IDE is the mode it's currently in - Design, Break or Run. On the…
mansellan
  • 373
  • 3
  • 9
1
2
3
14 15