I know that a function of a Module can be called in a formula like this:
=GetMyModuleFunction()
Now I would like to call a Class Module function. I don't know if a Class Module can be instantiated in a formula at all so I've created a function in a Module so I can call it just like =GetMyModuleFunction():
' Class Module MyClassModule:
Public Property Get MyProperty() As String
MyProperty = "Hello World!"
End Property
Public Function GetMyFunction() As String
GetMyFunction = "Hello World!"
End Function
' End Class Module MyClassModule
' Module MyModule:
Public Function GetMyClassModule() As MyClassModule
Set GetMyClassModule = New MyClassModule
End Function
' End Module MyModule
So after that I tried in the formula bar:
=GetMyClassModule().GetMyFunction()
=GetMyClassModule().MyProperty
Which shows an error dialog that the formula is invalid. Is it not possible what I'm trying to achieve here? Currently I use Modules instead but functions and subs with duplicate names are confusing and error prone to use in Modules..