ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Menu Options (https://www.excelbanter.com/excel-programming/317041-menu-options.html)

Glen Mettler[_4_]

Menu Options
 
How can I tell if the user has selected a menu option or a popup?

I have a macro that calculates hrs distributed over time. The user can
select a menu to start the calculation or the user can double click on a
cell in a column I named "Spread" and get a form that allows them to select
the kind of spread - Increasing, Decreasing, Level etc.

I need to know if the user has selected the menu or the popup.

I tried this in the code:

MyPik = Application.CommandBars.ActionControl.Caption

This will capture the particular menu option but causes an error if no menu
option has been excecuted.

If MyPik has a value then I will execute a section of code otherwise I will
assume the user form and execute another.

Any suggestions?

Glen



Bob Phillips[_6_]

Menu Options
 
Surely, the double-click can be trapped by the worksheet event, so you know
which one there, and the menu item would have an OnAction macro, so you know
which on there.

Do you knows how to code those?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Glen Mettler" wrote in message
...
How can I tell if the user has selected a menu option or a popup?

I have a macro that calculates hrs distributed over time. The user can
select a menu to start the calculation or the user can double click on a
cell in a column I named "Spread" and get a form that allows them to

select
the kind of spread - Increasing, Decreasing, Level etc.

I need to know if the user has selected the menu or the popup.

I tried this in the code:

MyPik = Application.CommandBars.ActionControl.Caption

This will capture the particular menu option but causes an error if no

menu
option has been excecuted.

If MyPik has a value then I will execute a section of code otherwise I

will
assume the user form and execute another.

Any suggestions?

Glen





Dick Kusleika[_4_]

Menu Options
 
Glen

On Error Resume Next
MyPik = Application.etc...
On Error Goto 0

If Len(MyPik) = 0 Then
'Double clicked
Else
'Menu
End If

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Glen Mettler" wrote in message
...
How can I tell if the user has selected a menu option or a popup?

I have a macro that calculates hrs distributed over time. The user can
select a menu to start the calculation or the user can double click on a
cell in a column I named "Spread" and get a form that allows them to

select
the kind of spread - Increasing, Decreasing, Level etc.

I need to know if the user has selected the menu or the popup.

I tried this in the code:

MyPik = Application.CommandBars.ActionControl.Caption

This will capture the particular menu option but causes an error if no

menu
option has been excecuted.

If MyPik has a value then I will execute a section of code otherwise I

will
assume the user form and execute another.

Any suggestions?

Glen






All times are GMT +1. The time now is 02:18 AM.

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