dcsimg
September 20, 2020
Hot Topics:

Add your AddIn to the VBIDE

  • By Sam Huggill
  • Send Email »
  • More Articles »
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 





This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.


Thanks for your registration, follow us on our social networks to keep up-to-date