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 |
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/ |
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 -------------------- |
All times are GMT +1. The time now is 01:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com