ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable and enable macro execution using VBA in another workbook? (https://www.excelbanter.com/excel-programming/337545-disable-enable-macro-execution-using-vba-another-workbook.html)

keithb

disable and enable macro execution using VBA in another workbook?
 
Workbook A.xls has a Worksheet_Change() subroutine that is unintentionally
executed when cell content is modified by VBA code in Workbook B.xls.

Using VBA code executing in Workbook B.xls, I would like to:
1) disable macro exection for workbook A.xls while its content is being
manipulated by VBA code in Workbook B.xls;
2) re-enable macro exection for workbook A.xls prior to saving it.

Any suggestions?

Thanks,

Keith



Norman Jones

disable and enable macro execution using VBA in another workbook?
 
Hi Keith,

Try wrapping the problematic instruction with EnableEvents statements,
e'g.:

Application.enableEvents = False 'Disable events

'code line(s)


Application.EnableEvents = True 're-enable events


---
Regards,
Norman



"keithb" wrote in message
...
Workbook A.xls has a Worksheet_Change() subroutine that is unintentionally
executed when cell content is modified by VBA code in Workbook B.xls.

Using VBA code executing in Workbook B.xls, I would like to:
1) disable macro exection for workbook A.xls while its content is being
manipulated by VBA code in Workbook B.xls;
2) re-enable macro exection for workbook A.xls prior to saving it.

Any suggestions?

Thanks,

Keith





All times are GMT +1. The time now is 12:42 PM.

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