ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Customized Menu Macro with Argument invoked twice (https://www.excelbanter.com/excel-programming/290356-customized-menu-macro-argument-invoked-twice.html)

alan

Customized Menu Macro with Argument invoked twice
 
I've created customized Menus which invoke macros, web
links and email.

The menu buttons work properly except for the menu
buttons which contain a macro with an argument. When the
menu button is selected, the macro is invoked twice. If
I remove the argument, the macro is invoked once. I've
tried this with several macros and menu buttons, same
behavior on all of them. This only happens when invoked
from a menu button. How do I include an argument and
prevent the macro from being invoked twice?

Also, I'd like to dynamically create/delete my customized
menus at startup/shutdown. Other forum threads discuss
how to do this, but this technique appears to have many
potential pitfalls. Has anybody successfully implemented
this for all cases? My MS Excel book recommends
distributing an *.xlb file with the menu customizations
and request the user creates a shortcut to this file.


Bob Phillips[_6_]

Customized Menu Macro with Argument invoked twice
 

"Alan" wrote in message
...
I've created customized Menus which invoke macros, web
links and email.

The menu buttons work properly except for the menu
buttons which contain a macro with an argument. When the
menu button is selected, the macro is invoked twice. If
I remove the argument, the macro is invoked once. I've
tried this with several macros and menu buttons, same
behavior on all of them. This only happens when invoked
from a menu button. How do I include an argument and
prevent the macro from being invoked twice?


Hoiw is the button created and the macro assigned? Show some code.


Also, I'd like to dynamically create/delete my customized
menus at startup/shutdown. Other forum threads discuss
how to do this, but this technique appears to have many
potential pitfalls. Has anybody successfully implemented
this for all cases? My MS Excel book recommends
distributing an *.xlb file with the menu customizations
and request the user creates a shortcut to this file.

I know of no such pitfalls, I do it all the time and it works wonderfully. I
have built myself a table driven routine, so all I have to do is put extra
rows in a worksheet, and I have a new button. Works well.



Tom Ogilvy

Customized Menu Macro with Argument invoked twice
 
Firing Twice

do you have parentheses around your arguments?

If so, remove them.

--
John Walkenbach has a table driven method as well which you might want to
look at:

http://j-walk.com/ss/excel/tips/tip53.htm
Creating Custom Menus

--
Regards,
Tom Ogilvy




"Bob Phillips" wrote in message
...

"Alan" wrote in message
...
I've created customized Menus which invoke macros, web
links and email.

The menu buttons work properly except for the menu
buttons which contain a macro with an argument. When the
menu button is selected, the macro is invoked twice. If
I remove the argument, the macro is invoked once. I've
tried this with several macros and menu buttons, same
behavior on all of them. This only happens when invoked
from a menu button. How do I include an argument and
prevent the macro from being invoked twice?


Hoiw is the button created and the macro assigned? Show some code.


Also, I'd like to dynamically create/delete my customized
menus at startup/shutdown. Other forum threads discuss
how to do this, but this technique appears to have many
potential pitfalls. Has anybody successfully implemented
this for all cases? My MS Excel book recommends
distributing an *.xlb file with the menu customizations
and request the user creates a shortcut to this file.

I know of no such pitfalls, I do it all the time and it works wonderfully.

I
have built myself a table driven routine, so all I have to do is put extra
rows in a worksheet, and I have a new button. Works well.





Alan[_21_]

Customized Menu Macro with Argument invoked twice
 

Thanks for the suggestions. I downloaded Walkenbach's table driven menu
system. This works nicely, there are a few limitations:

- I finally identified how to include web links for some menu items. I
had to add another field to the table for the web link and update the
VBA code to set the menu item appropriate attributes.

- I want one menu item to popup the Outlook Express Send mail window
with the "To" and Subject Field initialized. I have not found a way to
start Outlook Express Send from VBA. There are many examples using
Sendmail and Outlook, but I haven't found one for Outlook Express Send.
The Menu Editor allows you to do this so it is possible.

- Cannot specify an argument for the macro. May need more columns for
the arguments.

I still receive "firing twice" when invoking a menu item macro with an
argument. I've tried removing the () as suggested, I receive an error
and cannot enter it. I've noticed my Menu Editor list of user defined
functions (ie macros) is a small subset of the udf's (ie user defined
functions) listed in the Toolbar Insert Function udf. I think the
problem may be related to the missing udf's in the Menu Editor. Any
suggestions on how to update the Menu Editor udf list to be consistent
with the Toolbar Insert Function udf list? They should be the same.

thanks.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tom Ogilvy

Customized Menu Macro with Argument invoked twice
 
Outlook express does not expose an object model that can be driven by an
external application. Outlook (a totaly unrelated application with a
similar name) does expose an object model. I am not sure what the Menu
Editor.

John Walkenbach, on his site, has a sendkeys approach to manipulating
Outlook Express

--
Regards,
Tom Ogilvy

"Alan" wrote in message
...

Thanks for the suggestions. I downloaded Walkenbach's table driven menu
system. This works nicely, there are a few limitations:

- I finally identified how to include web links for some menu items. I
had to add another field to the table for the web link and update the
VBA code to set the menu item appropriate attributes.

- I want one menu item to popup the Outlook Express Send mail window
with the "To" and Subject Field initialized. I have not found a way to
start Outlook Express Send from VBA. There are many examples using
Sendmail and Outlook, but I haven't found one for Outlook Express Send.
The Menu Editor allows you to do this so it is possible.

- Cannot specify an argument for the macro. May need more columns for
the arguments.

I still receive "firing twice" when invoking a menu item macro with an
argument. I've tried removing the () as suggested, I receive an error
and cannot enter it. I've noticed my Menu Editor list of user defined
functions (ie macros) is a small subset of the udf's (ie user defined
functions) listed in the Toolbar Insert Function udf. I think the
problem may be related to the missing udf's in the Menu Editor. Any
suggestions on how to update the Menu Editor udf list to be consistent
with the Toolbar Insert Function udf list? They should be the same.

thanks.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 10:26 AM.

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