04-07-2003, 07:02 AM
I am new, as it is going to be obvious from my question. I used macros to find certain cells (heading of data columns) running them from custom menu items. I had to reinstall everything on my PC so I lost these macros, however before that I had saved a *.bas file.
I imported this file but the macros only work in the Excel file in which I imported. Could someone tell me how I can make these macros available for all the Excel files, please?
They should work for all of them, unless they are using the filename somewhere or the name of the Workbook.
04-07-2003, 07:53 AM
Thanks, that was a really quick answer. Yes, you are right they refer to the workbook, in which I imported the bas file. But I don’t know how to avoid this. Here it is what I have done step by step, maybe this helps:
I opened Excel then from menu Tools>Macro>Visual Basic Editor
In the VBE File>Import File (as the Import File command cannot be used if there is no opened workbook, I opened one). I imported the bas file. I closed VBE and I set up the custom menu referring to the macros. I saved this workbook.
When I open another workbook, the menu items work fine as long as I did not delete the above workbook, so this is a solution but I guess there is a proper one.
Also could you tell me whether I can save these customized menus and reload them if I have to reinstall my PC again, please?
PS. Maybe I wasn’t specific enough before. I have to work with a lot of workbook and I want to avoid to load the macros again and again and to modify the menu.
If I'm understanding you correctly, I think that you'll want to create an Add-In to do this. That way, your menus will be available to you as long as that Add-In is loaded (which would happen automatically if you wanted it to).
If your menus are added in the Workbook.Open event, then try saving the workbook as an Add-In (pick *.xla from the Save As type box).