ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copying a button with code into another workbook (https://www.excelbanter.com/excel-discussion-misc-queries/40410-copying-button-code-into-another-workbook.html)

Daniel Lees

Copying a button with code into another workbook
 
Hi

I have about 400 individual workbooks that i want to add a button with the
same code into each book is there any way to do this without going in and
recording the macro in each workbook. The workbooks are shared over the
network so i can't use my personal workbook i want to copy the button and
code into each workbook quickly. Can any1 help me?

Cheers

Danny

Dave Peterson

Chip Pearson has some code that shows how to do this kind of thing:
http://www.cpearson.com/excel/vbe.htm

But if you're adding that same button with the same code to 400 workbooks, it
might be simpler to create a toolbar in an addin and give the users a button on
that toolbar that will run your code.

Have the users open the addin whenever they need that function.

One of the nice things about separating your code from your data is if you have
to update that macro--to fix a mistake or to add more functionality. You'll
only have one spot to fix--instead of 400 (plus the copies the users made but
didn't tell you about!).

Here's how I make that toolbar:
http://groups.google.co.uk/groups?th...5B41%40msn.com

Daniel Lees wrote:

Hi

I have about 400 individual workbooks that i want to add a button with the
same code into each book is there any way to do this without going in and
recording the macro in each workbook. The workbooks are shared over the
network so i can't use my personal workbook i want to copy the button and
code into each workbook quickly. Can any1 help me?

Cheers

Danny


--

Dave Peterson


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

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