Calling VBA function that is in another module

  • Thread starter Thread starter Jag Man
  • Start date Start date
J

Jag Man

If I write

Private Function myFunct() As Long
....
End Function

Sub mySub()

I = myFunct()

....

End Sub

everything is OK. However, suppose I wish to put myFunct() in a separate
module. Then
it fails because the compiler can't find it. If myFunct() was in a DLL I
could use Declare
to tell the compiler about it, but that seems to work only for DLLs.

How can I get around this? Or, must all functions used in a module be
defined in it?


TIA

Ed
 
Hello Ed ;)

Private Function can be called from the same module, so pls change
Private to Public.
Or you can omit to write "Public", in this case, that UDF would be
treated as a Public Function.
(Note:Public Function should be placed in standard module)


Code:
 
Back
Top