View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default File won't close when "beforeclose" event is used.

It depends on what the code in the BeforeClose event is. If Cancel is being
set to True, the file won't close.

--

Vasant

"David G" wrote in message
...
I have an Excel file that opens up other files to
retreive info. Once the info is copied the files were to
be closed using the .close method. I could not figure out
why they wouldn't close. When I stepped through the VBA
code the files would close, but not when the code was
running by itself. I knew the files that I wanted to
close contained code in the beforeclose event. Once I
removed this code, the files closed as directed.
Is there a way around this? I've changed the files so
they no longer require code in the beforeclose event, but
I would like to know if this is a bug or if I have to add
something to allow code to be added to the beforeclose
event.