PC Review


Reply
Thread Tools Rate Thread

Closing multiple workbooks?

 
 
TerryM
Guest
Posts: n/a
 
      25th Nov 2008
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 & "" &
EndRow).Address
Range("A" & BeginRow & "" & 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 & "" &
EndRow).Address
Range("A" & BeginRow & "" & EndRow).Copy
wb.Activate
ActiveSheet.Paste
ActiveWorkbook.SaveAs "M:\ForeCasting DB\temp.xls"
ActiveWorkbook.Close
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing workbooks w/o closing Excel Barb in MD Microsoft Excel Misc 4 15th Feb 2010 06:44 PM
Closing multiple workbooks Telecorder Microsoft Excel Programming 1 31st Jan 2009 10:24 PM
Updating Workbooks from multiple links Workbooks TimJames Microsoft Excel Worksheet Functions 1 15th Dec 2007 03:34 PM
Multiple workbooks open -- closing workbooks =?Utf-8?B?SmFuZXQgUGFuaWdoZXR0aQ==?= Microsoft Excel Discussion 3 13th Nov 2007 05:43 PM
Closing excel application without closing all workbooks at the sa. =?Utf-8?B?S2l3aSBSb3hpZQ==?= Microsoft Excel Setup 2 30th Oct 2004 02:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:46 AM.