ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open workbook using VBA but don't run macros (https://www.excelbanter.com/excel-programming/374731-open-workbook-using-vba-but-dont-run-macros.html)

Paulymon

Open workbook using VBA but don't run macros
 
What is the line I can use to open a spreadsheet (123.xls say), but not run
the macros that are in the open event of 123.xls

I can open the workbook using
workbooks.open FileName:= "C:\123.xls"
but the macros run.

How do I do this? Is it possible?

Dave Peterson

Open workbook using VBA but don't run macros
 
application.enableevents = false
workbooks.open filename:="C:\123.xls"
application.enableevents = true

You may want to do the same thing when you close the workbook.

Paulymon wrote:

What is the line I can use to open a spreadsheet (123.xls say), but not run
the macros that are in the open event of 123.xls

I can open the workbook using
workbooks.open FileName:= "C:\123.xls"
but the macros run.

How do I do this? Is it possible?


--

Dave Peterson


All times are GMT +1. The time now is 08:46 AM.

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