Per favore, ricordati di usare i tag CODE /CODE (tra parentesi quadrate) quando posti del codice, altrimenti diventa tutto illeggibile.
Io ho provato questo codice e funziona:
In Excel:codice:<ComClass(alfa.ClassId, alfa.InterfaceId, alfa.EventsId)> _ Public Class alfa #Region "COM GUIDs" ' These GUIDs provide the COM identity for this class ' and its COM interfaces. If you change them, existing ' clients will no longer be able to access the class. Public Const ClassId As String = "c069be39-c81c-410e-8828-c348ab245956" Public Const InterfaceId As String = "a5e4ba01-217d-411d-b751-33b0a4b21a04" Public Const EventsId As String = "304e6fc0-5112-4690-8957-648a0f4b9cf8" #End Region ' A creatable COM class must have a Public Sub New() ' with no parameters, otherwise, the class will not be ' registered in the COM registry and cannot be created ' via CreateObject. Public Sub New() MyBase.New() End Sub Public Function Test() As String Return Now.ToString End Function End Class
codice:Public Sub Prova() Dim a As New alfa Debug.Print a.Test End Sub

Rispondi quotando