Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to Start a Macro by physically checking a check box? | Excel Discussion (Misc queries) | |||
Excel opening new copy of application for each file | Excel Discussion (Misc queries) | |||
Opening a specified sheet in an Excel file | Excel Discussion (Misc queries) | |||
create copy of sheet tab (excel 2007) when opening workbook | Excel Worksheet Functions | |||
Copy File Automatically on Opening It | Excel Discussion (Misc queries) |