Home |
Search |
Today's Posts |
#12
![]()
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.programming,microsoft.public.office.developer.vba,microsoft.public.officedev
|
|||
|
|||
![]()
Thanks Nick,
And this also answers my question if I can use the Workshhet.Copy method to copy from one workbook to another. I will try this later today. Assuming I do these steps: 1. Delete all chart sheets from the opened destination file 2. Delete all sheets from the destination file (except one, as it cannot be left empty, exception thrown on deleting the last one). 3. Copy all sheets and then all chart sheets from the source file 4. Delete the one leftover sheet from the original content of the destination I guess that this should get me into the position where the content of the destination is exactly like to content of the source. I mean values, formulas, formatting (cell types, fonts, grouping, borders, etc.), embedded charts and other COM objects (like embedded Word documents) in sheets are all transferred. I really hope that this will work. In case there are linked OLE objects, I assume that this would make the content of the destination refer to the same sources of the links as in the source workbook. Is this all correct? Regards, Levente "NickHK" wrote in message ... You say that you want "to make the opened document identic to the one I am copying from". If so then, create a copy of the file first, then open the copy: name oldfile as newfile workbooks.open newfile However, if you really mean that you want to import all the sheets from the oldfile into the newfile : Dim SourceWB as workbook Dim DestinationWB as workbook dim WS as worksheet set SourceWb =workbooks.open(oldfile) set DestinationWb =workbooks.open(newfile) for each ws in sourcewb.worksheets WS.Copy After:=DestinationWb.Sheets(DestinationWb.sheets.c ount) next NickHK "LF" wrote in message ... Hello, I have a workbook open and I want to populate it with the content of another xls file. How can I do that. I wan everything transferred: values, formulas, embedded object, formatting, everyhting. I figured that I coould do a sheet by sheet copy/paste (of course, enumerating the sheets and chart sheets in the source document, recreating them in the destination document and then doing the copy), but I am having a hard time copying over anything else than values. Also, where are the macros stored? In each sheet or are they workbook specific? Is there anything else to copy over to make the opened document identic to the one I am copying from? Because the destination workbook is already open, I cannot do a SaveCopyAs on the source workbook and then open that. I need to work with the one that is already opened. Any help or guidance is greately appreciated, thank you. Regards, Levente |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy pivot table and source from workbook 1 to 2. | Excel Discussion (Misc queries) | |||
Copy Worksheets from one Workbook to Another | Excel Worksheet Functions | |||
How do I copy a cell + it's formula from one workbook to another? | Excel Discussion (Misc queries) | |||
Copy tabs(sheets) from workbook without link to original source | Excel Discussion (Misc queries) | |||
copy COLUMN from 1 worksheet to another (in a different workbook) | Excel Discussion (Misc queries) |