Create public function to run code in Macro

M

Markantesp

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.
 
Top