vbe

How to restore VBA Editor to its initial settings?

扶醉桌前 提交于 2019-11-28 03:32:18
问题 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. 回答1: The only way I know how to accomplish this is to edit the registry. Close All Office programs Open a command prompt and type regedit Navigate to HKEY_CURRENTUSER\Software\Microsoft\VBA\6.0\Common Right click on Common and Export to save the *.reg file somewhere safe. This is your back up. Double clicking this file will restore your

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

对着背影说爱祢 提交于 2019-11-27 20:30:50
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 this: Option Explicit Option Private Module '@TestModule Private Assert As New Rubberduck.AssertClass '@TestMethod Public Sub TestMethod1() 'TODO: Rename test On Error GoTo TestFail 'Arrange: 'Act: 'Assert: Assert.Inconclusive TestExit: Exit Sub TestFail: Assert.Fail "Test raised an error: #" & Err.Number & " - " & Err.Description End Sub So I have this

Build add-in for VBA IDE using VB.NET

孤街浪徒 提交于 2019-11-27 18:12:50
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? It is possible you need to write a com addin using IDTExtensibility2 interface, select the shared addin project template from new project. EDIT Otherwise to create this addin from scratch you will need to do the following: Create a new project class library Add references to "Extensibility", it should be in the list. You may need to download the PIAs for your version of office. (and perhaps VSTO but i am unsure on this point)

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

时间秒杀一切 提交于 2019-11-27 15:23:05
问题 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 modules and writing it manually somehow seems like the only option. Sub-question: If you have to add Option Private Module to all modules in 10 applications what would you do? At first I was thinking to use a simple Replace and to replace the Option

Use Python to Inject Macros into Spreadsheets

心不动则不痛 提交于 2019-11-27 13:17:57
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 pyWin32, but I can't seem to figure out a way to use it to add the macro in. A similar question here gave this answer (it's not Python, but it looks like it still uses COM), but my COM object doesn't seem to have a member called VBProject: Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.DisplayAlerts = False Set

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

让人想犯罪 __ 提交于 2019-11-27 11:50:44
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 = srcVba.VBComponents(moduleName) srcModule.Export (path) 'Export from source trgtVba.VBComponents.Remove VBComponent:=trgtVba.VBComponents.Item(moduleName) 'Remove from target trgtVba.VBComponents.Import (path) 'Import to target However now I need to copy VBA code that is in a Sheet, not in a Module. The above method doesn't work for that scenario. What code can I use to copy VBA code in a

Alternative IDE for VB6 and VBA [closed]

╄→гoц情女王★ 提交于 2019-11-27 10:27:30
I've been spoiled by Visual studio 2008 and Eclipse and have to do a little maintainence work on a VB6 app. Does anyone know of an alternative/ updated IDE for VB6? A rewrite is not an option I'm just fixing a couple of bugs and it's a big codebase. I have never heard of an alternative IDE for Vb6. However, these two (free) VB6 add-ins are indispensable and will make your life easier - especially if there is a lot of code. They are equally effective for VBA in Microsoft Office. MZ-Tools : provides a superb collection of IDE tools - finding unused variables, unused methods, a great "search all"

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

岁酱吖の 提交于 2019-11-26 22:58:40
问题 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 this: Option Explicit Option Private Module '@TestModule Private Assert As New Rubberduck.AssertClass '@TestMethod Public Sub TestMethod1() 'TODO: Rename test On Error GoTo TestFail 'Arrange: 'Act: 'Assert: Assert.Inconclusive TestExit: Exit Sub

Build add-in for VBA IDE using VB.NET

ⅰ亾dé卋堺 提交于 2019-11-26 19:21:16
问题 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? 回答1: It is possible you need to write a com addin using IDTExtensibility2 interface, select the shared addin project template from new project. EDIT Otherwise to create this addin from scratch you will need to do the following: Create a new project class library Add references to "Extensibility", it should be in the list.

Alternative IDE for VB6 and VBA [closed]

时光毁灭记忆、已成空白 提交于 2019-11-26 15:10:39
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I've been spoiled by Visual studio 2008 and Eclipse and have to do a little maintainence work on a VB6 app. Does anyone know of an alternative/ updated IDE for VB6? A rewrite is not an option I'm just fixing a couple of bugs and it's a big codebase. 回答1: I have never heard of an alternative IDE for Vb6. However,