In VBA, Open a file with macros disabled

  • Thread starter Thread starter Otto Moehrbach
  • Start date Start date
O

Otto Moehrbach

Excel 2002, WinXP
My macro security is set to Medium.
I have a file that I need to open (in VBA) in order to extract some data
from it, then close it. That file has Open and Close event code that I
don't want to run during this task.
How do I code to open that file with macros disabled?
Or how can I code to open that file such that the Open/Close code will not
execute?
Thanks for your help. Otto
 
Application.EnableEvents = False
set bk = Workbooks.Open( Filename:="C:\MyFolder\MyFile.xls")
' process workbook
bk.Close
Application.EnableEvents = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top