Make function in form class module visible to AutoKeys macro

X

XP

Using Office 2003 and Windows XP;

I have an AutoKeys macro that fires on a certain code combination. However,
this macro cannot see the function to call if it is placed in one of the
class modules associated with a form. Even if I use a "Public" function.

Question: Is there a way to make my function DIRECTLY visible and callable
by the AutoKeys macro if it resides in a form's class module? If so, how?

Thanks much for your assistance.
 
O

Ofer Cohen

Better to create the function in a module, and then call it from both, the
form and the macro.

For your question, you can call a function in a form
Try,

Form_FormName.SubName
 
X

XP

Thanks, but it doesn't work, probably because the form is not open; I guess
for your method to work, the form must be open?

Is there a way for it to find the function even if the form is closed? - or
open the form then run the function?
 
O

Ofer Cohen

It should run the sub or function that defined in a form even if the form is
closed.

Check the names of the objects.

FormName and Sub/Function name
 
X

XP

Sorry, but it still doesn't work; it says it can't find my form; I have
triple checked and copied the name exactly. My function name looks like this:

Form_frmEditData.AdminOpen()

I'm using a function in the form module: Public Function AdminOpen()

I tried it with and without the parentheses. Any ideas?
 
O

Ofer Cohen

You right, the macro doesn't recognise it.
What you can do is to create a function in a mudule that call the function
in the form, and then call that function from the macro (I don't like it, to
complex).

Why don't you move the function from the form to a module, that way you can
call it from the form and macro.
 

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