ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Applying Macro to all workbooks... (https://www.excelbanter.com/excel-programming/290438-applying-macro-all-workbooks.html)

Trevor[_4_]

Applying Macro to all workbooks...
 
Hello All,

I have created a macro that I need to use whenever I
import a text file. However, the macro is only associated
with the file that I wrote it in. How do I make it
available to any file I have open? As of now, I have to
go find the original file I wrote the macro for and
copy/paste the code into the current workbook. I know
there has to be a better way. Any help is much
appreciated.

Thanks.

Tom Ogilvy

Applying Macro to all workbooks...
 
hard to say without seeing the macro, but in general, if you use
activcecell, activesheet, activeworkbook rather than specific names for
these, it should work with the current workbook/sheet/cell.

--
Regards,
Tom Ogilvy


"Trevor" wrote in message
...
Hello All,

I have created a macro that I need to use whenever I
import a text file. However, the macro is only associated
with the file that I wrote it in. How do I make it
available to any file I have open? As of now, I have to
go find the original file I wrote the macro for and
copy/paste the code into the current workbook. I know
there has to be a better way. Any help is much
appreciated.

Thanks.




No Name

Applying Macro to all workbooks...
 
Tom,

That's good info, thank you. But once I do that, how do I
access that macro when I open a new workbook?

Thanks for your help.
Trevor

-----Original Message-----
hard to say without seeing the macro, but in general, if

you use
activcecell, activesheet, activeworkbook rather than

specific names for
these, it should work with the current

workbook/sheet/cell.

--
Regards,
Tom Ogilvy


"Trevor" wrote in

message
...
Hello All,

I have created a macro that I need to use whenever I
import a text file. However, the macro is only

associated
with the file that I wrote it in. How do I make it
available to any file I have open? As of now, I have to
go find the original file I wrote the macro for and
copy/paste the code into the current workbook. I know
there has to be a better way. Any help is much
appreciated.

Thanks.



.


Tom Ogilvy

Applying Macro to all workbooks...
 
Well, the macro has to be in an open workbook, so I would use a single
workbook to store my macros and open it when I need it or put it in the
xlstart directory and it will be opened whenever the workbook is opened.
There special provision made for such a workbook - the personal.xls
workbook. If you record a macro, excel offers to store the macro in
personal workbook. If you select this option and it doesn't exist, it is
created. If it already exists, the macro is stored there. this workbook is
opened whenever excel is opened (manually) and is marked as hidden so it
doesn't appear in excel. This is where most people place macros they want
to use as you describe.

--
Regards,
Tom Ogilvy


wrote in message
...
Tom,

That's good info, thank you. But once I do that, how do I
access that macro when I open a new workbook?

Thanks for your help.
Trevor

-----Original Message-----
hard to say without seeing the macro, but in general, if

you use
activcecell, activesheet, activeworkbook rather than

specific names for
these, it should work with the current

workbook/sheet/cell.

--
Regards,
Tom Ogilvy


"Trevor" wrote in

message
...
Hello All,

I have created a macro that I need to use whenever I
import a text file. However, the macro is only

associated
with the file that I wrote it in. How do I make it
available to any file I have open? As of now, I have to
go find the original file I wrote the macro for and
copy/paste the code into the current workbook. I know
there has to be a better way. Any help is much
appreciated.

Thanks.



.





All times are GMT +1. The time now is 04:19 AM.

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