Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scope of private function in VBA Module oscar.c.marin[_2_] Excel Programming 2 October 20th 08 10:49 PM
scope of private function called from UserForm fails oscar.c.marin Excel Programming 1 October 20th 08 04:48 AM
Improve method of calling a private function in a private module XP Excel Programming 1 April 30th 08 06:41 PM
variable scope question in user-defined function Pertti Excel Programming 2 October 17th 06 07:11 PM
Calling Private Sub/Function AMK4[_36_] Excel Programming 5 February 4th 06 01:47 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"