Calling the wrong macro
Thanks Tom, I'd kinda hoped that it would work in much the same way as MS
Word - but it obviously doesn't
You have saved me from wasting a lot more of time though - thanks again.
Philip
"Tom Ogilvy" wrote in message
...
Toolbars are at the application level. When you assign a macro to the
toolbar, it includes the specific workbook that contains the macro and
this
does not change (nor does it adjust if you move that workbook outside of
excel). You would need to add code in the workbook activate event for the
specific workbooks where you want that behavior, that reassigns the
macro --
assign the button's onaction property to the macro in that workbook.
--
Regards,
Tom Ogilvy
"Philip" wrote in message
news:FKVed.19982$Pl.3636@pd7tw1no...
Thanks Tom,
Yes, you're right, I'm calling it from a toolbar button - I guess that
must
make a difference. So I suppose my question should really be: How do I
make
a toolbar and it's associated macros launced specific to a Workbook.
I've tried playing around with it but having created a toolbar it seems
to
appear in all Workbooks? That suprises me a little
Thanks again for replying - I appreciate your help
Regards
Philip
"Tom Ogilvy" wrote in message
news:dtTed.113212$Lo6.75092@fed1read03...
I guess it depends on what you mean by Call MyMacro1. If you are
doing
it
with a menu button, then it is tied to a specifice macro - probably
the
one
in workbook B.
--
Regards,
Tom Ogilvy
"Philip" wrote in message
news:A6Sed.19054$Pl.17748@pd7tw1no...
Hi Folks,
Any help with this would be much appreciated:
I have two workbooks created in Excel 2000, Book A and Book B
Both work books contain a macro which have the same name: MyMacro1
MyMacro1 contains different code in each workbook
When I call MyMacro1 in Book A, Excel opens Workbook B and runs the
code
within the Book B - MyMacro1
I can't figure out why this happening - has anyone any ideas please?
I've tried deleting both macros and recreating them independently -
to
no
avail!
TIA
Philip
|