How to program auto_open to simulate button click in userform
Solved
cecileC92
Posted messages
2
Status
Member
-
cecileC92 Posted messages 2 Status Member -
cecileC92 Posted messages 2 Status Member -
Hello,
My first question on the forum...
Here's my problem. I'm a beginner in VBA and I've been asked to create a program that simulates databases in a certain format. These databases will be directly incremented into a tab of an Excel file called "SKEL" which itself contains macros that launch another software. In the "SKEL" file, there are buttons and userforms that trigger the macros. The goal, once my macro has generated the databases that have been successfully incremented into the "SKEL" file, is for the SKEL file's macros to run automatically without having to click a button. In my "SKEL" file, I have a first button that, once clicked, allows the launch of a menu created in a userform which contains private subs. In the auto_open of my SKEL, I managed to simulate an automatic button click that properly displays the menu. Now, I can't trigger the button of the userform. How can I do that.... I'm not sure if that's clear.
Thank you for your help,
Best regards,
Cécile
My first question on the forum...
Here's my problem. I'm a beginner in VBA and I've been asked to create a program that simulates databases in a certain format. These databases will be directly incremented into a tab of an Excel file called "SKEL" which itself contains macros that launch another software. In the "SKEL" file, there are buttons and userforms that trigger the macros. The goal, once my macro has generated the databases that have been successfully incremented into the "SKEL" file, is for the SKEL file's macros to run automatically without having to click a button. In my "SKEL" file, I have a first button that, once clicked, allows the launch of a menu created in a userform which contains private subs. In the auto_open of my SKEL, I managed to simulate an automatic button click that properly displays the menu. Now, I can't trigger the button of the userform. How can I do that.... I'm not sure if that's clear.
Thank you for your help,
Best regards,
Cécile
2 answers
-
Hello,
How do you "simulate" the click on the button of the sheet?
--
🎼 Best regards,
Franck 🎶 -
Hello,
Strange question, because you are automating things that were previously done manually while keeping the previous appearance. We're distorting the UserForm...
Well, otherwise try addingButton_Click
(adapting the name "Button"). When the UserForm appears, it will behave as if a magic user is quickly pressing the button.
Talk later!-
-
Hello Franck,
I completely agree with you; that's why it seems strange to me to modify the code this way.
But that's how I understood Cécile's question.
See you!- Personally, I thought I understood that she wanted to create a macro in another workbook that would open this "SKEL" workbook and automatically perform some actions (button clicks on sheets and/or UserForms).
But I could be wrong.
So wait and see...
However, if I’m right, it will be necessary to:
- remove the Private from the Subs of the UserForm
- call the event procedures using CallByName as described HERE
-
-