Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy: copy workbook code

Status
Not open for further replies.

sochidog

Technical User
Jun 26, 2003
22
CA
Afternoon All!
I've got this macro that copies all the sheets from a source workbook into a new workbook. However, I am missing the code in the "ThisWorkbook" object. Y'know the workbook_open and close stuff that I've added. How do I copy and paste that over.
:)
 
You want to copy ALL sheets and ALL code from a source workbook into a NEW workbook ?
Why not simply playing with the SaveAs method ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
There is massive code all over the place... the master sheet creates "lite" versions of itself. A few sheets here and there, certain modules, certain lines, etc. "SaveAs" is not what i want. I just want to copy the code from the "ThisWorkbook" object to the "NewWorkbook" object. How to do?
 
Depending of your version of excel you may have security issues when playing with the VBProject.VBComponents collection.
Have you tried to play with a template (.xlt) ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi sochidog,

As an aside ...

As you couldn't do it yourself what made you think it was easy (as per the thread title)?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Hello,

you could try stripping the file of everything that it doesn't need and use SaveAs, then reopen your master-file and go at it again.

Cheers,

Roel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top