Auto Click Userforms

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Hi,

I'm not sure if if this can be done, but i figured I'd ask. I have code that opens another workbook and changes data, which generates a userform that you must then click OK for the code to continue running. Is there a way to "bypass" that userform, by writing code that will click the "OK" button?

Thanks!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I have code that opens another workbook and changes data, which generates a userform that you must then click OK for the code to continue running

Does the userform simply require unloading?
- please post the code behind the "OK" command button
 
Last edited:
Upvote 0
unfortunately, i can't get the code. I think one is an unload only, but there is another that is not. Thanks for responding!
 
Upvote 0
I, too, would advise trying to get ahold of the code behind the OK button. That's definitely the more robust option.

But if that's just not possible, then search here for threads on the subject of SendKeys. That should get you started. Post back if you get stuck after having played with SendKeys a bit.
 
Upvote 0
Surely someone has access to the code. Could that person modify it?

:warning: be very careful if you try to use sendkeys
- a user clicking on "OK" waits until the button is there
- VBA does not wait unless forced to!
 
Upvote 0
How is the userform 'generated' in the other workbook?

If it's via event code you could disable events in your code, open the other workbook, change the data, close the other workbook and enable events again.
 
Last edited:
Upvote 0
Does the code opens the new workbook in the same excel instance or in a seperate one ? And is the UserForm Modal or Modeless ?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top