Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
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
How to Start a Macro by physically checking a check box? Mr Imnotabrainsurgeon Excel Discussion (Misc queries) 3 September 24th 09 09:11 PM
Excel opening new copy of application for each file Michelle Excel Discussion (Misc queries) 2 July 31st 09 08:02 AM
Opening a specified sheet in an Excel file BarryHNZ Excel Discussion (Misc queries) 3 February 27th 09 08:36 PM
create copy of sheet tab (excel 2007) when opening workbook jatman Excel Worksheet Functions 1 February 29th 08 12:26 PM
Copy File Automatically on Opening It Dolores Excel Discussion (Misc queries) 4 December 30th 05 07:12 PM


All times are GMT +1. The time now is 08:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"