Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Closing multiple workbooks?

Here is my issue, I have a macro that parses text out of a imported file. To
do this I have to Open up one workbook and save it as another (temp.xls)
workbook. The temp file closes or at least appears to however I don't
believe the original workbook closes because I still have a excel.exe in the
Task Manager. Is there any way to rectify this issue, or any code
adjustments that I could make?


Dim wb As Workbook, BeginRow As Long, EndRow As Long
Dim myFile As String
Dim myRange As Range
Workbooks.Open "M:\Forecasting DB\Cin.xls"
BeginRow = [A:A].Find("EJ", after:=[A1]).Row
EndRow = [A:A].Find("EJ", [A65000], , , xlColumns, xlPrevious).Row
ActiveWorkbook.Names.Add "myRange1", Range("A" & BeginRow & ":D" &
EndRow).Address
Range("A" & BeginRow & ":D" & EndRow).Copy
Workbooks.Add 1
Set wb = ActiveWorkbook
ActiveSheet.Paste
[A65000].End(xlUp).Offset(1).Select
Workbooks("CIN.xls").Activate
BeginRow = [A:A].Find("EM", after:=[A1]).Row
EndRow = [A:A].Find("EM", [A65000], , , xlColumns, xlPrevious).Row
ActiveWorkbook.Names.Add "myRange2", Range("A" & BeginRow & ":D" &
EndRow).Address
Range("A" & BeginRow & ":D" & EndRow).Copy
wb.Activate
ActiveSheet.Paste
ActiveWorkbook.SaveAs "M:\ForeCasting DB\temp.xls"
ActiveWorkbook.Close
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Closing multiple workbooks?


Try adding


Code:
--------------------
wb.Close
--------------------
at the end

You will still have Excel open though

Code:
--------------------

'close Excel
Application.Quit
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33787

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
Closing workbooks w/o closing Excel Barb in MD Excel Discussion (Misc queries) 3 February 15th 10 06:42 PM
closing workbooks Eric Excel Programming 2 September 19th 07 01:56 PM
Closing Workbooks bodhisatvaofboogie Excel Programming 4 June 20th 06 01:57 PM
Closing Other Workbooks Tim Mayes[_2_] Excel Programming 4 December 13th 04 11:08 PM
Closing workbooks Mischa Browne Excel Programming 4 June 17th 04 04:16 PM


All times are GMT +1. The time now is 05:30 PM.

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"