Is it possible to write Excel VBA Code in Visual Studio

VBA code for Excel can only be written inside Excel using the VBA IDE. VBA projects are stored as part of the Excel file and cannot be loaded into Visual Studio.

However, you can write VSTO (Visual Studio Tools for Office) managed add-ins for Excel using Visual Studio. The following MSDN page covers both developing with VBA and VSTO.

Excel for developers

You could also use the interop features of VBA to consume a (COM) object written in Visual Studio from your VBA code.


The best you can do is bend the office Visual Basic Editor (VBE) tool to your liking. If you stay in it's native environment you get the full power of error detection, Intellisense, live code running, etc.

My tips...

  1. In the VBE go to Tools > Options > Editor tab.
    Turn off 'Auto Syntax Check'. You still get code highlighted errors but no annoying popups.

  2. Go to the Editor Format tab and change the Font to Consolas (Western), Size 11.

  3. For code indenting install the awesome, free, Code Manager. It adds some sick keyboard shortcuts.
    enter image description here

  4. Make the Edit toolbar easily accessible for code commenting/uncommenting. enter image description here

  5. Use Rubberduck to add unit testing, source control, code inspections and refactoring functionality.

Rubberduck Menu

With those simple changes you end up with a half way decent, useful, and keyboard friendly environment to write your visually appealing code. :-D

enter image description here