Firstly you need to create a class library using visual studio and then
define functions within that file.
Imports System
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
<ClassInterface(ClassInterfaceType.AutoDual), ComVisible(True)> _
Public Class AddinFunctions
<ComRegisterFunctionAttribute()> _
Shared Sub RegisterFunction(ByVal type As Type)
Registry.ClassesRoot.CreateSubKey("CLSID\{" _
& type.GUID.ToString().ToUpper() & "}\Programmable")
End Sub
<ComUnregisterFunctionAttribute()> _
Shared Sub UnregisterFunction(ByVal type As Type)
Registry.ClassesRoot.DeleteSubKey("CLSID\{" _
& type.GUID.ToString().ToUpper() & "}\Programmable", False)
End Sub
Function Travel_Expenses(ByVal Exc)
Travel_Expenses = "This is travel exp"
End Function
End Class
^^That was an example
Once you have created the .dll add it to your project reference.
Thereafter apply this code for your Axspreadsheet object.
atp = CreateObject("OWCAddin.AddinFunctions")
AxSpreadsheet1.AddIn(addIn:=atp)
To make sure you have done the referencing properly, check your object
browser and all your functions should appear there.
Regards