Excel does not execute a button's code when another macro simulate
If i understand correctly you just need to insert a module, create a function
and paste the code that is run on button press there such as
Public Function pushButton()
/code here
End Function
then under the button click just type Call pushButton
and you can type the same thing in your code, it will call whether button is
clicked or not.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.
" wrote:
Hi all-
I have a button, named Button1, on a worksheet. I have a macro which
does several actions, including moving the mouse cursor over Button1 &
simulating a mouse_down & mouse_up. I use SetCursorPos() and
mouse_event() for this. I find that Button1's code does not execute
when its click is simulated within another macro. Calling
Button1_click() directly is not an option because the Button1_click
code is in a password protected macro which I cannot view.
The end goal is to be able to have the macro do something like this:
1) copy A1's value to A2
2) simulate Button1 being clicked
3) After Button1 is done (known to be < 1minute), copy A3's value to
A4
Does anyone know a fix or workaround for any part of this?
Thank you!
Zachary harrison
|