Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel does not execute a button's code when another macro simulates mouse movements & clicks

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel does not execute a button's code when another macro simulate

Thank you for your reply. Either I didn't exlpain my original issue
properly or I'm not understanding your suggestion.

I have an XLS with a button on it. This XLS has password protected
code (XLS1). My goal is to use a second XLS which I will author
(XLS2). XLS2 will manipulate some of the data on the sheets in XLS1,
then simulate pushing the button in XLS1 & collect the results. The
problem is that the simulation of pushing the button doesn't "happen"
until the macro is done.

The solution I came up with is to have XLS2 manipulate the data,
simulate a button press on XLS1 & use the application.onTime method to
have XLS2 pickup the results after a minute.

Regards

Zach


On Jul 16, 1:24 pm, John Bundy (remove) wrote:
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- Hide quoted text -


- Show quoted text -



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I execute a macro right after the user clicks the validation drop down? Michael[_44_] Excel Programming 1 December 23rd 06 08:05 PM
Creating a macro that simulates some of the toolbar button Duangruthai New Users to Excel 1 April 22nd 06 12:12 AM
Demonstrating mouse clicks with Macro JEFF Excel Programming 4 July 6th 05 04:04 AM
controlling another application via VBA code in Excell & sending keystrokes & mouse clicks Zaidan Excel Programming 0 June 6th 04 09:06 PM
Plot where mouse clicks Leo Excel Programming 1 November 14th 03 02:50 PM


All times are GMT +1. The time now is 12:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"