Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default workbook close delay

I have a code that is perplexing me and I am hoping one of the experts
can help. I have a main workbook that contains all the subroutines
and a main menu. this workbook is opened at the beginning of the
business day. Through the main menu, the user will open and close
various data files depending on the project needs, however, excel and
the main program will stay open all day.

The issue that I am seeing is the workbook("filename").close false
step executes very quickly the first time, but it takes longer and
longer each time it is evoked from the code. prior to opening a new
data file, a subroutine is called to clear the existing data. In that
routine is the command to close the current data file.

Here are the parts of the code

in a separate routine
sub open_data_file()
....
Set g_wbData = Application.Workbooks.Open(strDataFilePath &
strDataFileName)
...
end sub

sub clear_data()
...
With Application
.EnableEvents = False
.Calculation = xlCalculationManual
.DisplayAlerts = False
End With
debug.print timer

g_wbData.close false '<---- this step takes longer each time
it is executed

debug.print timer
With Application
.EnableEvents = true
.Calculation = xlCalculationAutomatic
.DisplayAlerts = True
End With
...
end sub

I have used a timer to monitor the execution time of the single step.
it starts at ~0.15 seconds and increases by 0.25 seconds each time a
data file is opened and the clear_data routine is subsequently used.
After 20 or so repetitions the delay gets unacceptable. If I close
excel and restart the main program the execution starts at 0.15
seconds again.
Any suggestions? Is there some data that is saved from the closed
workbook that is using memory?
Reply
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
Hide all Sheets in Workbook then Close Workbook RyanH Excel Programming 0 January 29th 08 12:59 PM
Open New Workbook / Save and Close Current Workbook Joe K. Excel Programming 1 December 7th 07 08:04 PM
Workbook sheet code delay Colin Hayes Excel Discussion (Misc queries) 4 June 10th 07 12:02 AM
Long delay opening a workbook through our Intranet for some users Jacques Trépanier Links and Linking in Excel 0 April 20th 07 08:58 PM
Help on Workbook close and workbook save events Adam Harding Excel Programming 1 September 29th 05 04:12 PM


All times are GMT +1. The time now is 07:25 PM.

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

About Us

"It's about Microsoft Excel"