Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calling VBA function that is in another module
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calling VBA function that is in another module
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: -------------------- Public Function myFunct() As Long -------------------- --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calling VBA function that is in another module
Colo,
Thanks! I thought I'd tried that, but I now see that it works. Ed "Colo " wrote in message ... 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: -------------------- Public Function myFunct() As Long -------------------- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calling a function in my SQL-DB from VBA | Excel Discussion (Misc queries) | |||
calling a module | Excel Discussion (Misc queries) | |||
Calling function from a userform | Excel Discussion (Misc queries) | |||
Calling a module function from a class method | Excel Programming | |||
Calling Macros oustide current module | Excel Programming |