View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Raul[_4_] Raul[_4_] is offline
external usenet poster
 
Posts: 28
Default Closing a workbook programmatically

I am loosely using the workbooks.open method to open a
workbook and then extracting some data from it. The
routine opens the workbook and gets the desired
information. However, I'd like to close the workbook
before moving on to other steps but I can't seem do it.

Can anyone help me out with this one?

......
Workbooks.Open "K:\AAAA\BBBB\CCCC\excelfile.xls"
Set currentBook = Application.ActiveWorkbook
'do other stuff

Workbooks(currentBook).Close
.....
The routine doesn't crash, it just doesn't close the
workbook. I don't need to save any changes to the file I
want to close. I also have other workbooks open that I
don't want closed.

Thanks,
Raul