ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Scope of private function (https://www.excelbanter.com/excel-programming/418786-scope-private-function.html)

oscar.c.marin[_2_]

Scope of private function
 
I have declared a private function in a VBA Module, but a get a "Sub or
Function not defined" error when called from a UserForm.

Any ideas?

Thanks in advance.

Oscar

Bob Phillips[_3_]

Scope of private function
 
That is because the scope is restricted to the module that the private
procedure is within.

To make it available to another module it must be Public. You can have the
procedures public but private to the project (that is not accessible from
another project, and not in the macros list in Excel), by making the
procedure public and by adding the phrase Option Private Module to the
module declarations at the start.

--
__________________________________
HTH

Bob

"oscar.c.marin" wrote in message
...
I have declared a private function in a VBA Module, but a get a "Sub or
Function not defined" error when called from a UserForm.

Any ideas?

Thanks in advance.

Oscar





All times are GMT +1. The time now is 11:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com