View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default In VBA, Open a file with macros disabled

Application.EnableEvents = False
set bk = Workbooks.Open( Filename:="C:\MyFolder\MyFile.xls")
' process workbook
bk.Close
Application.EnableEvents = True

--
Regards,
Tom Ogilvy

"Otto Moehrbach" wrote in message
...
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