Microsoft & .NETVisual BasicAdd your AddIn to the VBIDE

Add your AddIn to the VBIDE

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

This tip helps you to add your add-in to the VBIDE. Here is some simple connect code:

Make sure the startup object is Sub Main.

Global gobjIDEAppInst As Object 

Declare Function_
WritePrivateProfileString_
Lib "kernel32" _
Alias "WritePrivateProfileStringA"_
(ByVal AppName As String, _
ByVal KeyName As String, ByVal_
keydefault As String, ByVal _
FileName As String) 

Declare Function_
GetPrivateProfileString_
Lib "kernel32" Alias _
"GetPrivateProfileStringA"_
(ByVal AppName As String, ByVal _
KeyName As String,_
ByVal keydefault_
As String, ByVal _
returnstring As String,_
ByVal NumBytes As Integer, _
ByVal FileName As String) 

Sub Main() 
'// Change "Project1.class1"_
    to projectname.classname 
'// where the class contains
    AfterClick() 
'// events, etc. 
Dim strSection As String 
Dim returnstring As String 
strSection = "Add-Ins32" 
returnstring = String$(12, Chr$(0)) 
errcode = GetPrivateProfileString_
(strSection, "Project1.class1", _
"NotFound", returnstring,_
Len(returnstring) + 1, "VB.INI") 
If Left(returnstring, errcode) =_
"NotFound" Then 
  errcode = WritePrivateProfileString_
(strSection, "Project1.class1", _
  "0", "VB.INI") 
End If 
End Sub 

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories