![]() |
userform question on UserForm_Click()
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. |
userform question on UserForm_Click()
The UserForm_Click() macro is not your problem. Tha macro is a private sub
that will only affect the form that it resides behind. "SteveDB1" wrote: 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. |
userform question on UserForm_Click()
JLG,
you were correct. yet another one of those stupid spelling errors. Thanks. "JLGWhiz" wrote: The UserForm_Click() macro is not your problem. Tha macro is a private sub that will only affect the form that it resides behind. "SteveDB1" wrote: 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. |
userform question on UserForm_Click()
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. "SteveDB1" wrote: JLG, you were correct. yet another one of those stupid spelling errors. Thanks. "JLGWhiz" wrote: The UserForm_Click() macro is not your problem. Tha macro is a private sub that will only affect the form that it resides behind. "SteveDB1" wrote: 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. |
All times are GMT +1. The time now is 12:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com