(optionally) (C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\.dll)Īdd a class to your project with the following code: (C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\) (C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\.dll) Here is my version to aid people in the future:Ĭreate a C# or VB.NET Class Library project named "VBEAddIn"Īdd the following Interop assemblies as references to the project, using the "Project", "Add Reference." menu, "Browse" tab.Įxtensibility (C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Common\Extensibility.dll) - if its not there try the C:\Program Files (x86)\ if your using a 圆4 PC. Unfortunately almog.ori's steps didn't work for me. 'FontHeight=10 (DWORD - Default if missing) 'FontFace=Courier New (STRING - Default if missing) 'HKEY_CURRENT_USER\Software\Microsoft\VBA\6.0\Common
"Description"="Description for your new the tokens "YourGeneratedGuid" must have the curly braces included and be the same as the Guid in the attrib above, the token "YourAssemblyNameFullTypeName" must be the Assembly full name, the token "YourAddinName.Connect" must be the same ProgId set in the attrib above.Īlso found this helpful, might save you couple hours googling. key script to register the Addin, note you will need to change some of the settings in order to register it properly. Public Sub OnBeginShutdown(ByRef As Array) ''' Receives notification that the host application is being unloaded. ''' Implements the OnBeginShutdown method of the IDTExtensibility2 interface. Public Sub OnStartupComplete(ByRef As Array) ''' Receives notification that the host application has completed loading.
''' Implements the OnStartupComplete method of the IDTExtensibility2 interface. Public Sub OnAddInsUpdate(ByRef As Array) ''' Receives notification that the collection of Add-ins has changed. ''' Implements the OnAddInsUpdate method of the IDTExtensibility2 interface. Public Sub OnDisconnection(ByVal disconnectMode As ext_DisconnectMode, ByRef As Array) ''' Array of parameters that are host application specific. ''' Describes how the Add-in is being unloaded. ''' Receives notification that the Add-in is being unloaded. ''' Implements the OnDisconnection method of the IDTExtensibility2 interface. 'TODO: Remove types found in assembly using reference. Private Sub onReferenceItemRemoved(ByVal reference As Reference) 'TODO: Map types found in assembly using reference. Private Sub onReferenceItemAdded(ByVal reference As Reference) Public Sub OnConnection(ByVal application As Object, ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, ByRef As Array) ''' Describes how the Add-in is being loaded. ''' Receives notification that the Add-in is being loaded. ''' Implements the OnConnection method of the IDTExtensibility2 interface. Private _application As VBE 'Interop VBE application object ''' The object for implementing an Add-in. You will need to register the Addin into the right Registry location, see the registry keys that follow to get an idea, also replace some vars in the registry keys. Heres an implementation to get you started, Firstly replace the "YourAddinName" with your AppName and Create a Guid for "YourGeneratedGuid". Call this class "Connect" (this is just a preference).
You may need to download the PIAs for your version of office. Add references to "Extensibility", it should be in the list.Otherwise to create this addin from scratch you will need to do the following: It is possible you need to write a com addin using IDTExtensibility2 interface, select the shared addin project template from new project.