Not really, but if you are trying to simulate something like the clicking of
a command button, you can fire the event with something like this:
Call MyCommandButton_Click()
If only it was that simple. I'd have to make the call from a subform to the
parent.
At the moment I place the focus on the button and sendkeys a space. Which
works but dos'nt seem RIGHT.
Thanks
Remove the Private keyword from the front of the declaration for the
button's event in the main form's, i.e. from this line:
Private Sub MyCommandButton_Click()
Then in the subform, try:
Me.Parent.MyCommandButton_Click
or:
Form_Form1.MyCommandButton_Click
where "Form1" represents the name of your main form.
If you want to click a Button, you can call the button.PerformClick()
method. If you want to click a different Control, you can create a Click
handler for that Control and simply call the click handler directly.
However, if you want to click the mouse in an arbitrary location (i.e., not
on a control) you can use the User32 SendInput function to send a MOUSEINPUT
structure with the appropriate mouse click.
Or if you want to avoid messing with the platform invoke required to call
SendInput, we offer a .NET component FREE for non-commercial use that will
handle all of this for you:
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.