ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy module from one file to another (https://www.excelbanter.com/excel-programming/340528-copy-module-one-file-another.html)

[email protected]

Copy module from one file to another
 
Hi-

I have a macro file that opens along with another file and the macro is
run against the file. I copy a bunch of buttons from the macro file to
the new file and currently have all of the code in the macro file as a
place to store it. The problem I am having is the buttons reference
the modules in the macro file. So when the macro file is closed and
you press the buttons in the new file that is created from the
macro....it errors out.

How can I get the code that is stored in this macro file into modules
in the new file that is created so that I don't have to keep the macro
file open in order to use the buttons?

TIA,
Chris


Jim Thomlinson[_4_]

Copy module from one file to another
 
Check out this link...

http://www.cpearson.com/excel/vbe.htm
--
HTH...

Jim Thomlinson


" wrote:

Hi-

I have a macro file that opens along with another file and the macro is
run against the file. I copy a bunch of buttons from the macro file to
the new file and currently have all of the code in the macro file as a
place to store it. The problem I am having is the buttons reference
the modules in the macro file. So when the macro file is closed and
you press the buttons in the new file that is created from the
macro....it errors out.

How can I get the code that is stored in this macro file into modules
in the new file that is created so that I don't have to keep the macro
file open in order to use the buttons?

TIA,
Chris



Tom Ogilvy

Copy module from one file to another
 
when you copy the buttons over, then reassign the onaction property of the
buttons to reference the workbook in which you placed them.

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
Hi-

I have a macro file that opens along with another file and the macro is
run against the file. I copy a bunch of buttons from the macro file to
the new file and currently have all of the code in the macro file as a
place to store it. The problem I am having is the buttons reference
the modules in the macro file. So when the macro file is closed and
you press the buttons in the new file that is created from the
macro....it errors out.

How can I get the code that is stored in this macro file into modules
in the new file that is created so that I don't have to keep the macro
file open in order to use the buttons?

TIA,
Chris




[email protected]

Copy module from one file to another
 
Tom-

Anyway you can give me a quick rundown of how to do the above?

Much appreciated!

-Chris



All times are GMT +1. The time now is 02:40 PM.

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