ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combine Workbooks (https://www.excelbanter.com/excel-programming/348347-combine-workbooks.html)

LRL[_2_]

Combine Workbooks
 
My workflow is as follows:

1) The user creates a workbook from a template (file.xlt) which has a
number of macros and userforms in various modules including the
workbook and the worksheet. He makes various changs to the new
workbook.

2) The user has his own workbook which may or may not have his own
macros.

3) The user wants to insert the worksheet created from the template
into his own workbook. If he uses move/copy sheet, the sheet gets
moved, but only the macros associated with the worksheet are moved. Any
attempt to run them fails since they refer to routines in the modules.

How can I combine the two workbooks together so that all the code
modules move from my workbook into his workbook?

Thanks
LRL


Dave Peterson

Combine Workbooks
 
You could give the user the ability to copy over the macros.

See Chip Pearson's site:
http://www.cpearson.com/excel/vbe.htm

But you may want to reconsider your approach. Maybe you could give the users a
separate addin that contains all the macros that they need. Then get as much
code out of the workbook as you can.

This'll save you when you find that error that needs to be corrected--you'll
just have to fix the addin, not each workbook that may have copied that code.



LRL wrote:

My workflow is as follows:

1) The user creates a workbook from a template (file.xlt) which has a
number of macros and userforms in various modules including the
workbook and the worksheet. He makes various changs to the new
workbook.

2) The user has his own workbook which may or may not have his own
macros.

3) The user wants to insert the worksheet created from the template
into his own workbook. If he uses move/copy sheet, the sheet gets
moved, but only the macros associated with the worksheet are moved. Any
attempt to run them fails since they refer to routines in the modules.

How can I combine the two workbooks together so that all the code
modules move from my workbook into his workbook?

Thanks
LRL


--

Dave Peterson


All times are GMT +1. The time now is 01:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com