onAction behaviour

jvit1964
03-27-2006, 03:02 AM
hi to everybody

in a worbook i have a workbook_open macro that creates a custom command bar with a few menuitems that refer to specific macros saved inside the workbook
and i have a workbook_close macro that deletes the custom command bar as well
ive assigned each macro to each specific command using the .onaction event
it happens that if i save this workbook with a different name, all menuitems still refer to the original file, tryin to open it.

ive tried with the application.thisworkbook and the application.activeworkbook parameters tryin to give the .onaction parameter the name of the file from which run all macros

is there a any solution, but store all macros in a separate file on the server?

thanx for any kind suggestion
vit

jvit1964
03-27-2006, 07:25 AM
ive fixed the problem adding a workbook_activate subroutine in which i delete the custom bar and build a new one exatctly the previous one. in this way the menu seems to work referrin to active workbook

vit

italkid
03-27-2006, 12:53 PM
is there a any solution, but store all macros in a separate file on the server?

If you would work with an add-in, yes...

jvit1964
03-28-2006, 12:18 AM
well im not keen with add-ins
i never created one
where shud it reside in a a 1 file server with many desktop computers configuration?

thanx
vit

italkid
03-28-2006, 02:45 AM
If the commandbar is really workbook specific, then creating the toolbar at runtime might still be the best solution, though when you'd need the same commandbar over and over, store the code necessary to create / delete the commandbar in an add-in, would be a more solid solution. This approach would allow you to store all of the necessary code in one single file (much easier to edit), but will need you to install the add-in on each single computer...

jvit1964
03-28-2006, 04:50 AM
thats what i needed to know cause thi workbook shud be portable also when u r in other office or companies
i think the more effective solution is to keep the commandbar specific instead to install the add-in on every computer
thanx for ur kind help and suggestions italkid
ill keep them in mind in the future
ciao
vit

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum