![]() |
Application Level macros
Hi, i would like to create a macro which I can run from excel in general not just one workbook. Is there a way? I'd like to create a button that will run some code regardless of which workbook is open. Thanks -- modjoe23 ------------------------------------------------------------------------ modjoe23's Profile: http://www.excelforum.com/member.php...o&userid=26376 View this thread: http://www.excelforum.com/showthread...hreadid=398344 |
Application Level macros
If you add the macro to Personal.xls and add a toolbar button that calls it,
you can run it on the activeworkbook, as long as you code it appropriately. -- HTH RP (remove nothere from the email address if mailing direct) "modjoe23" wrote in message ... Hi, i would like to create a macro which I can run from excel in general not just one workbook. Is there a way? I'd like to create a button that will run some code regardless of which workbook is open. Thanks -- modjoe23 ------------------------------------------------------------------------ modjoe23's Profile: http://www.excelforum.com/member.php...o&userid=26376 View this thread: http://www.excelforum.com/showthread...hreadid=398344 |
Application Level macros
Just to add to Bob's reply.
It might be safer to create that toolbar on the fly when your workbook opens. Here's how I do it: http://groups.google.co.uk/groups?th...5B41%40msn.com If you want to add items to the worksheet menu bar, you can use John Walkenbach's menumaker: http://j-walk.com/ss/excel/tips/tip53.htm modjoe23 wrote: Hi, i would like to create a macro which I can run from excel in general not just one workbook. Is there a way? I'd like to create a button that will run some code regardless of which workbook is open. Thanks -- modjoe23 ------------------------------------------------------------------------ modjoe23's Profile: http://www.excelforum.com/member.php...o&userid=26376 View this thread: http://www.excelforum.com/showthread...hreadid=398344 -- Dave Peterson |
Application Level macros
Thank you guys for your replies. However, my question was how to create a macro that is universal. Maybe an example would simplify what I'm trying to accomplish. I would like to have a button, for example Set Autofilter On that can be run any time i use excel and with any workbook to set the autofilter to ON. I know how to create the menubars and all I just don't know how to the macro application specific rather than workbook or worksheet specific. I hope this is clearer. Thanks -- modjoe23 ------------------------------------------------------------------------ modjoe23's Profile: http://www.excelforum.com/member.php...o&userid=26376 View this thread: http://www.excelforum.com/showthread...hreadid=398344 |
Application Level macros
"modjoe23"
wrote in message ... Thank you guys for your replies. However, my question was how to create a macro that is universal. Maybe an example would simplify what I'm trying to accomplish. I would like to have a button, for example Set Autofilter On that can be run any time i use excel and with any workbook to set the autofilter to ON. I know how to create the menubars and all I just don't know how to the macro application specific rather than workbook or worksheet specific. I hope this is clearer. Thanks Hi, Bob's reply was the answer you are looking for. All code must exist within a workbook in some way. That workbook could be personal.xls (which is usually hidden by default) or perhaps in an add-in (xla). If you always want the button to be available, the approach is to use one of those options with personal.xls probably being best if you want it only available to yourself, and an add-in a better approach if you want to distrinbute it to others. Perhaps a better question for us to ask would be, in what way does that not meet your requirements? Personal.xls could be used (as per the example in Dave's post) to create a menubar button each time excel is opened (no matter what workbook(s) are opened with the excel application or later) that would turn on an autofilter. HTH, Alan. |
Application Level macros
Hi Alan, Thank you for your clarification. I was just looking for a confirmatio that this is the only way it can be done because I saw some o application level events in excel 97 but that turned out to be totall useless. It looks like Bob's solution will owrk and i'll implement i that way. Thank you bot -- modjoe2 ----------------------------------------------------------------------- modjoe23's Profile: http://www.excelforum.com/member.php...fo&userid=2637 View this thread: http://www.excelforum.com/showthread.php?threadid=39834 |
Application Level macros
You can create application level events, but there is no event in your
example to trap, and anyway by using Activeworkbook, it will apply to whatever workbook is active. Personal.xls is a handy receptacle for universal code as you call it, as it always opens when Excel starts. You just have to be careful to qualify the objects. For instance, you may have code that picks a certain worksheet Set myWs = Worksheets("Sheet99") but a further statement of say Range("A1").Copy will apply to the activesheet because it is not qualified, not necessarily the sheet that you want. -- HTH RP (remove nothere from the email address if mailing direct) "modjoe23" wrote in message ... Hi Alan, Thank you for your clarification. I was just looking for a confirmation that this is the only way it can be done because I saw some on application level events in excel 97 but that turned out to be totally useless. It looks like Bob's solution will owrk and i'll implement it that way. Thank you both -- modjoe23 ------------------------------------------------------------------------ modjoe23's Profile: http://www.excelforum.com/member.php...o&userid=26376 View this thread: http://www.excelforum.com/showthread...hreadid=398344 |
Application Level macros
There are lots of builtin tools that could be added to your favorite toolbar.
Before I'd start creating macros, I'd look through tools|Customize|Commands tab. You'll find both autofilter and showall icons that you can drag to a toolbar. (and lots more) modjoe23 wrote: Thank you guys for your replies. However, my question was how to create a macro that is universal. Maybe an example would simplify what I'm trying to accomplish. I would like to have a button, for example Set Autofilter On that can be run any time i use excel and with any workbook to set the autofilter to ON. I know how to create the menubars and all I just don't know how to the macro application specific rather than workbook or worksheet specific. I hope this is clearer. Thanks -- modjoe23 ------------------------------------------------------------------------ modjoe23's Profile: http://www.excelforum.com/member.php...o&userid=26376 View this thread: http://www.excelforum.com/showthread...hreadid=398344 -- Dave Peterson |
All times are GMT +1. The time now is 12:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com