ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deactivate automatic macros on import (https://www.excelbanter.com/excel-programming/391082-deactivate-automatic-macros-import.html)

CLR

Deactivate automatic macros on import
 
Hi All......
I am trying to open a second Excel file and retrieve a copy of one of the
worksheets. I've done this many times successfully, with other files, but
this one has automatic macros attached to the sheet and workbook modules
which are messing things up by trying to engage. How might I be able to open
this book and copy a sheet from it to another workbook, and in so doing,
disable all the sheet and workbook macros?.....and circumvent the "workbook
is in use, do you want to open read-only" message.

TIA
Vaya con Dios,
Chuck, CABGx3



Dave Miller

Deactivate automatic macros on import
 
Disable events before you open the workbook:

Application.EnableEvents = False

Remember to enable again after you are done with the sheet.

Regards,
David Miller


CLR

Deactivate automatic macros on import
 
Thanks David.....but I still can't get past the "file is in use, open as
read-only?" message.

Vaya con Dios,
Chuck, CABGx3



"Dave Miller" wrote:

Disable events before you open the workbook:

Application.EnableEvents = False

Remember to enable again after you are done with the sheet.

Regards,
David Miller



CLR

Deactivate automatic macros on import
 
To close the loop............I wasn't able to get there with any sort of a
Copy and Paste procedure, but was finally able to get what I needed by using
a macro to run a custom MSQuery.

Vaya con Dios,
Chuck, CABGx3

"CLR" wrote:

Hi All......
I am trying to open a second Excel file and retrieve a copy of one of the
worksheets. I've done this many times successfully, with other files, but
this one has automatic macros attached to the sheet and workbook modules
which are messing things up by trying to engage. How might I be able to open
this book and copy a sheet from it to another workbook, and in so doing,
disable all the sheet and workbook macros?.....and circumvent the "workbook
is in use, do you want to open read-only" message.

TIA
Vaya con Dios,
Chuck, CABGx3




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

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