ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I run two macros in the same time? (https://www.excelbanter.com/excel-programming/364725-can-i-run-two-macros-same-time.html)

emil

Can I run two macros in the same time?
 
Can I run two macros in the same time?
Thank for the help
Emil.


Jim Thomlinson

Can I run two macros in the same time?
 
That would require multi-threading and the answer is no. That being said what
are you up to that leads you to believe you want to run two different macro's
at the same time?
--
HTH...

Jim Thomlinson


"emil" wrote:

Can I run two macros in the same time?
Thank for the help
Emil.


witek

Can I run two macros in the same time?
 
Jim Thomlinson wrote:
That would require multi-threading and the answer is no. That being said what
are you up to that leads you to believe you want to run two different macro's
at the same time?


The answer in general is no.
But sometimes is yes.

Create two user forms and set their Show modal property to false.
Put you macro to Form_Activate() or UserForm_Click() or similar place
where you can somehow start it.

Now you have mutli-threading because Windows is in its nature
mutli-threading.



emil

Can I run two macros in the same time?
 
Thank, but I must explain:
I rules two macros. The first macro record and print an order with
quantities from an available stock of items. It rules in 30 seconds. After
this order I must print another order but I must check the stock and the
client for that. This macro rules in 3 minutes, and is too long time.
How can I solve this problem?
Thank for any idea.
Emil.


"Jim Thomlinson" a scris:

That would require multi-threading and the answer is no. That being said what
are you up to that leads you to believe you want to run two different macro's
at the same time?
--
HTH...

Jim Thomlinson


"emil" wrote:

Can I run two macros in the same time?
Thank for the help
Emil.


Jim Thomlinson

Can I run two macros in the same time?
 
I do not beleive that is correct. At no point in time can I have two threads
of exectution running concurrently (even with 2 userforms). Try this. Create
two userforms with a button and a label on each. Attach this code to the
button of each...

Private Sub CommandButton1_Click()
Dim lng As Long

For lng = 1 To 10000000
Label1.Caption = lng
Repaint
Next lng
End Sub

Now display both forms non-modal and run the code on each form. I think you
will find you can't. You can not begin execution of code on the second form
until the code on the first form completes.
--
HTH...

Jim Thomlinson


"witek" wrote:

Jim Thomlinson wrote:
That would require multi-threading and the answer is no. That being said what
are you up to that leads you to believe you want to run two different macro's
at the same time?


The answer in general is no.
But sometimes is yes.

Create two user forms and set their Show modal property to false.
Put you macro to Form_Activate() or UserForm_Click() or similar place
where you can somehow start it.

Now you have mutli-threading because Windows is in its nature
mutli-threading.




emil

Can I run two macros in the same time?
 
Thank you very much. I must try it, i think that is not simple but I will try.
Emil

"witek" a scris:

Jim Thomlinson wrote:
That would require multi-threading and the answer is no. That being said what
are you up to that leads you to believe you want to run two different macro's
at the same time?


The answer in general is no.
But sometimes is yes.

Create two user forms and set their Show modal property to false.
Put you macro to Form_Activate() or UserForm_Click() or similar place
where you can somehow start it.

Now you have mutli-threading because Windows is in its nature
mutli-threading.





All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com