LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Close doesn't always close

Greetings all,

I need to pick your collective brains again since I couldn't find this
exact issue in the archives. I've got a workbook which looks in a
particular directory on a fileserver, and loops through each .xls
file: opening, copying some key bits, pasting, and then closing each.
There's roughly 50 excel files in the directory that this workbook
deals with. Everything seems to work fine except at the end of the
run, there's usually a half-dozen files left open. All the others were
successfully closed, but not these brave few. This has become
something of a proud nail for me - it's really only a minor
inconvenience, but it's starting to bug the heck out of me. ;^)

Here's what I'm doing (Excel 2007 by the way):

Sub PullData()
'declarations and other stuff snipped

File = Dir(CStr(SrcDir & "\*.xls*"))
Do While Len(File) 0

'open each workbook
Set srcWbk = Workbooks.Open(SrcDir & "\" & File)

'does a bunch of copy/paste stuff here, snipped


srcWbk.Close True
File = Dir

Loop
End Sub


Any thoughts? That srcWbk.Close bit just seems to get ignored around
15% of the time.

thanks!

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I stop the close method in an auto close macro Paul Excel Programming 2 November 17th 06 02:48 PM
Don't let user close. Use macro button to close? mike Excel Programming 2 October 30th 06 01:31 PM
In Before Close Sub ActiveWorkBook.Close(False) repeat procedure [email protected] Excel Programming 5 September 26th 06 03:11 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
excel - Windows close button (x) should only close active workboo. CoffeeAdict Setting up and Configuration of Excel 3 February 8th 05 04:30 AM


All times are GMT +1. The time now is 01:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"