vikashtiwari,
Had you said that the execution of macros took a very long time, then I would have been able to suggest modifications to your code (such as turning off ScreenUpdating, setting the calculations to manual, using arrays instead of collections, etc.); but the problem with opening, saving and closing a file generally relates to the SIZE of the file.
One question I have though is -- When does the file connect to the database? If it connects when it's opened, then that might be cause for delay (it could be changed to connecting only when certain processes are run).
One of the things that often contributes to the size of Excel file (with the associated opening, closing, and out-of-memory problems) are storing complex formulas in a lot of cells. The way to alleviate this problem is to have any macros which create formulas to turn the formulas into values after the result is computed (by the formula).
To make a long story short ââ you should probably experiment with different approaches and see which works best. Do you really need 40 worksheets in 1 workbook?
For more info recommend
http://www.vba-programmer.com
CarlR