Combining VBA and Managed Code Extensions
The features in this topic are available only if you have the required applications installed.
For more information, see.
It is not recommended that you use Visual Basic for Applications (VBA) code in document-level customizations for Microsoft Office Word or Microsoft Office Excel. If your solution requires it, however, you can use both types of code in a single project.
When you open your project in Visual Studio, the document is opened in design mode. VBA code does not run when the document is in design mode, so you can work on the document and managed code extensions without triggering the VBA event handlers.
When you run the solution, event handlers in both VBA and the managed code extensions pick up events that are raised in the document, and both sets of code run. You cannot determine beforehand which code will run before the other; you must determine this through testing in each individual case. You can get unexpected results if the two sets of code are not carefully coordinated and tested.