Make Function Accessible only from VBA

R

Ryan Poth

Hi,
I have a few UDFs that should only be callable from VBA
(they are meaningless as spreadsheet functions). Does
anybody know how to make a UDF invisible to the
spreadsheet, but visible to any/all VBA modules? I don't
think the "Private" designation is appropriate because it
makes the UDF invisible to all other VBA modules.

An example of this would be the MsgBox function, which is
callable from any VBA module, but not callable directly
from a spreadsheet.

Thanks in advance for any help.
Ryan
 
R

Rob Bovey

Hi Ryan,

Using the Option Private Module directive will prevent public functions
from being displayed in the function wizard. If the user knows the exact
name and argument list they can still enter the function in a cell and it
will get called, but this isn't normally a problem. I'm pretty sure the only
way to prevent any use in a worksheet function is to either make your
functions private or wrap them in a class module and use them in your VBA
project through an instance of the class.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top