![]() |
Copy a Sheet without physically opening the file
Is there a way that I can copy a sheet from one file to the next without
having to use: Workbooks.Open "Filename", True, True My problem is I wish to copy Sheet1 from one file to the next, then close the original file. Currently I can make it work but I do not know how to get back to the file once I perform the copy sheet command. Note: The filename may change. Thank you for your help in advance!!! (smile) Mike |
Copy a Sheet without physically opening the file
Hi Michael
Set Wb2 = Workbooks.Open("C:\test.xls") You can always use Wb2 in your code to refer to the sheet you have open Sub test() Dim Wb1 As Workbook Dim Wb2 As Workbook Application.ScreenUpdating = False Set Wb1 = ActiveWorkbook Set Wb2 = Workbooks.Open("C:\test.xls") Wb2.Worksheets(1).copy after:= _ Wb1.Sheets(Wb1.Sheets.Count) Wb2.Close False Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Michael Kintner" wrote in message ... Is there a way that I can copy a sheet from one file to the next without having to use: Workbooks.Open "Filename", True, True My problem is I wish to copy Sheet1 from one file to the next, then close the original file. Currently I can make it work but I do not know how to get back to the file once I perform the copy sheet command. Note: The filename may change. Thank you for your help in advance!!! (smile) Mike |
All times are GMT +1. The time now is 11:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com