Add your AddIn to the VBIDE

by Sam Huggill

Add your AddIn to the VBIDE Some simple connect code.

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_
Lib "kernel32" _
Alias "WritePrivateProfileStringA"_
(ByVal AppName As String, _
ByVal KeyName As String, ByVal_
keydefault As String, ByVal _
FileName As String) 

Declare Function_
Lib "kernel32" Alias _
(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
'// 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 
This article was originally published on Wednesday Nov 20th 2002
Mobile Site | Full Site