userform question on UserForm_Click()

S

SteveDB1

Morning all,
I've made my second user form, and placed it in my xlam file so I can access
it through my customized ribbon (it's not feasible to place a button on each
workbook due to our internal office file structures).

My first form works good there, and once I made my second one, I did the
same with it, as my first-- placed it in my xlam file, and made the link to
it through my ribbon.

However, the second form doesn't allow me access through the xlam file.
It's throwing a cannot access error due to either "not being in the xlam
file, or macros being disabled." And I know the macros are not disabled.

I've checked the spelling of the form.show for each incidence in the xlam,
and the xml side-- they match. I've checked to make sure that I have the
Control as IRibbonControl in place.


It appears that with each user form it creates a private sub called
UserForm_Click().
I'm guessing at this point that my problem is due to have two
UserForm_Click() macros in two distinctly named/different user forms, and
that this is causing some form of an ambiguity error.

My question is:

Am I supposed to name each subsequent UserForm_Click function a different
name?

Or can Excel differentiate between them on its own? (each one is in its own
userform.)

Thank you.
Best,
SteveB.
 
J

JLGWhiz

The UserForm_Click() macro is not your problem. Tha macro is a private sub
that will only affect the form that it resides behind.
 
J

JLGWhiz

Glad you found it Steve. If you use Option Explicit at the top of your
module, it will find those mispelled variables for you before you try to run
them. It also forces you to declare all variables for data type before you
use them, but that is not so bad once you get used to it.
 

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