In VBA (Access) I created a classmodule called "ZFormHelperClass" with a public function "FromStart"
Public Function FromStart(ByVal name As String, Optional ByVal lfd As Long = InvalidLfd, Optional ByVal centerd As Boolean = False) As ZFormContainerClass
'Do something
End Function
I use a public function in a module as a constructor for this class:
Public Function ZFormHelper() As ZFormHelperClass
Set ZFormHelper = New ZFormHelperClass
End Function
Then I tried to use a macro ("Test") to call this function in "Run Code" (or "Execute Code") like this:
=ZFormHelper.FromStart("Start", -1, True)
But it does not even let me save the Macro (Error: german version of: "Invalid value form the functionname argument"). I had to create a function do do this.
Function doStart()
Call ZFormHelper.FromStart("Start", -1, True)
End Function
So I wonder why this is the way it is and if there is a way to call a class function directly without having to create a dummy-function.