ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automate Open an XLS without running macro (https://www.excelbanter.com/excel-programming/394538-automate-open-xls-without-running-macro.html)

matelot

Automate Open an XLS without running macro
 
I've created an XLS containing macro that I use as a template. I create
another XLS that contains macro to extract data from Access and populate into
the XLS template for each person. The problem is that once the code open the
template, it always asks whether I want to disable or enable the macro. Is
there a way for my code in the second XLS to open the template and disable
the macro because it has events in there that I don't want to run while I
populate the data.

Thanks for your help.
Mat

Peter T

Automate Open an XLS without running macro
 
Apart perhaps from Sendkeys I don't think so. Maybe you could temporarily
disable Events, but be careful to include error handling to ensure events
are re-enabled when done. Alternatively flag something that the code in the
other wb will recognise to early exit event code.

Regards,
Peter T


"matelot" wrote in message
...
I've created an XLS containing macro that I use as a template. I create
another XLS that contains macro to extract data from Access and populate

into
the XLS template for each person. The problem is that once the code open

the
template, it always asks whether I want to disable or enable the macro. Is
there a way for my code in the second XLS to open the template and disable
the macro because it has events in there that I don't want to run while I
populate the data.

Thanks for your help.
Mat




matelot

Automate Open an XLS without running macro
 
Thanks Peter. I'll try your approach. It sounds like it's going to work.

"Peter T" wrote:

Apart perhaps from Sendkeys I don't think so. Maybe you could temporarily
disable Events, but be careful to include error handling to ensure events
are re-enabled when done. Alternatively flag something that the code in the
other wb will recognise to early exit event code.

Regards,
Peter T


"matelot" wrote in message
...
I've created an XLS containing macro that I use as a template. I create
another XLS that contains macro to extract data from Access and populate

into
the XLS template for each person. The problem is that once the code open

the
template, it always asks whether I want to disable or enable the macro. Is
there a way for my code in the second XLS to open the template and disable
the macro because it has events in there that I don't want to run while I
populate the data.

Thanks for your help.
Mat






All times are GMT +1. The time now is 10:19 AM.

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