LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.programming,microsoft.public.office.developer.vba,microsoft.public.officedev
LF LF is offline
external usenet poster
 
Posts: 32
Default How to copy workbook?

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
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
copy pivot table and source from workbook 1 to 2. dakotasteve Excel Discussion (Misc queries) 0 September 27th 06 06:05 PM
Copy Worksheets from one Workbook to Another halem2 Excel Worksheet Functions 3 March 25th 06 06:04 AM
How do I copy a cell + it's formula from one workbook to another? excel _ help for the hopeless, please Excel Discussion (Misc queries) 4 October 11th 05 11:48 PM
Copy tabs(sheets) from workbook without link to original source Rich Ulichny Excel Discussion (Misc queries) 3 August 25th 05 02:11 AM
copy COLUMN from 1 worksheet to another (in a different workbook) DavidB Excel Discussion (Misc queries) 3 January 15th 05 02:47 PM


All times are GMT +1. The time now is 06:42 AM.

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

About Us

"It's about Microsoft Excel"