ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Temporarily pause macro so that changes can be made on a workbook (https://www.excelbanter.com/excel-programming/411038-temporarily-pause-macro-so-changes-can-made-workbook.html)

Farooq Sheri

Temporarily pause macro so that changes can be made on a workbook
 
I have macro that opens up a file ("Book1") and pastes some info onto it from
another file. I have code (While loop) in the macro that checks whether
"Book1" is still open or not. What happens is that with the macro running in
background I am unable to do any action on Book1. I have tried putting in a
Wait timer but things remain the same. Is there a way to get around this. I
want the code to continue once I close Book1.

Thanks in advance

Matthew Pfluger

Temporarily pause macro so that changes can be made on a workbook
 
Try putting a STOP command in your code where you want the macro to pause.

HTH,
Matthew Pfluger

"Farooq Sheri" wrote:

I have macro that opens up a file ("Book1") and pastes some info onto it from
another file. I have code (While loop) in the macro that checks whether
"Book1" is still open or not. What happens is that with the macro running in
background I am unable to do any action on Book1. I have tried putting in a
Wait timer but things remain the same. Is there a way to get around this. I
want the code to continue once I close Book1.

Thanks in advance


T Lavedas

Temporarily pause macro so that changes can be made on a workbook
 
On May 16, 7:46 am, Farooq Sheri
wrote:
I have macro that opens up a file ("Book1") and pastes some info onto it from
another file. I have code (While loop) in the macro that checks whether
"Book1" is still open or not. What happens is that with the macro running in
background I am unable to do any action on Book1. I have tried putting in a
Wait timer but things remain the same. Is there a way to get around this. I
want the code to continue once I close Book1.

Thanks in advance


It sounds like you want to add a DoEvents in the macro loop. It
should allow manipulation of data in the target spreadsheet.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/

Farooq Sheri

Temporarily pause macro so that changes can be made on a workb
 
thanks for the reply; I have tried putting "Stop" command and the macro does
stop but it won't start unless I do so manually. Is there a way to auto start
it once a certain condition is met such as when I close Book1.

"Matthew Pfluger" wrote:

Try putting a STOP command in your code where you want the macro to pause.

HTH,
Matthew Pfluger

"Farooq Sheri" wrote:

I have macro that opens up a file ("Book1") and pastes some info onto it from
another file. I have code (While loop) in the macro that checks whether
"Book1" is still open or not. What happens is that with the macro running in
background I am unable to do any action on Book1. I have tried putting in a
Wait timer but things remain the same. Is there a way to get around this. I
want the code to continue once I close Book1.

Thanks in advance


Farooq Sheri

Temporarily pause macro so that changes can be made on a workb
 
Can you please be specific; the macro should stop but should restart once
Book1 is closed.

Thanks

"T Lavedas" wrote:

On May 16, 7:46 am, Farooq Sheri
wrote:
I have macro that opens up a file ("Book1") and pastes some info onto it from
another file. I have code (While loop) in the macro that checks whether
"Book1" is still open or not. What happens is that with the macro running in
background I am unable to do any action on Book1. I have tried putting in a
Wait timer but things remain the same. Is there a way to get around this. I
want the code to continue once I close Book1.

Thanks in advance


It sounds like you want to add a DoEvents in the macro loop. It
should allow manipulation of data in the target spreadsheet.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/



All times are GMT +1. The time now is 02:14 PM.

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