September 20, 2018
Hot Topics:

Making Your First Addin

  • November 19, 2002
  • By Sam Huggill
  • Send Email »
  • More Articles »

Make a new Standard EXE project. Add a mdoule (AddIn). Set the projects Startup Object to Submain and copy the following code into the module:

Option Explicit

Declare Function GetPrivateProfileString Lib "kernel32" _
  Alias "GetPrivateProfileStringA" _
  (ByVal AppName As String, ByVal KeyName As String, _
  ByVal keydefault As String, _
  ByVal result As String, ByVal resultSize As Long, _
  ByVal filename As String) As Long
Declare Function WritePrivateProfileString& _
  Lib "kernel32" Alias _
  "WritePrivateProfileStringA" (ByVal AppName$, _
  ByVal KeyName$, ByVal keydefault$, ByVal filename$) _
  As Long

Const AddInName = "VBSAddIn"

Sub InstallAddIn()
' Add a reference in the VBADDIN.INI file
Dim result As String, errCode As Long

' try to read the entry in VBADDIN.INI
result = Space$(256)
GetPrivateProfileString "Add-Ins32", AddInName _
  & ".Connect", "***", result, _
  Len(result), "vbaddin.ini" 

If Left$(result, 3) = "***" Then
  ' the entry is not there, so we must write it
  errCode = WritePrivateProfileString("Add-Ins32", _
    AddInName & ".Connect", "0", _
End If

' If errCode Then
'  MsgBox "Error while accessing VBADDIN.INI", vbCritical
' End If

End Sub

Sub Main()
If App.StartMode = 0 Then
End If
End Sub

Page 2 of 4

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

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

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.


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