Create public function to run code in Macro

G

Guest

I have written code in a module. I am trying to create a macro that will run
this code by using Runcode action. However, access won't allow me to select
the function name. From previous posts, I learned that it must be a public
function. How do I create a "public" function?
 
G

George Nicholson

Public Sub MyCode()

or

Public Function MyCode(strArg as Argument) As String

Private is the alternative to Public and is the default if omitted.
 
D

Douglas J. Steele

Actually, Public is the default, George.

It should be pointed out that the sub or function should be in a module, not
in the class associated with a form.
 

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