Excel Click Event

Add-in Express™ Support Service
That's what is more important than anything else

Excel Click Event
Excel Click Event 
ewessely




Posts: 55
Joined: 2019-01-31
Hello Andrei,
I'm looking for a onClick event for excel worksheets...

Situation: My wizard opens a (windows) form allowing the user to enter cell references. The user should also be able to enter a reference by simply clicking on a cell. I then take the cell as refence.

Current solution: I use the ExcelAppEvent SheetSelectionChange which gives me sheet + range I need.
Problem: The user may also click on a cell which is allready selected, so no SheetSelectionChange will be triggered. (of course - this is behav. is expected....). Currently the user has to select any cell and the again click on the desired on - functional, but dirty solution :-(

So: which event will be fired when my wizard is open, when a user clicks on an allready selected cell/range? Doing similar with the excel built in function wizard gets the cell reference. So I'm sure, there should be such an event.
Do you have any hint for me?

br
Erich
ew
Posted 28 May, 2021 05:35:57 Top
Andrei Smolin


Add-in Express team


Posts: 18219
Joined: 2006-05-11
Hello Erich,

There's no onClick event. Do you get the WindowActivate event after you switch from your form to the Excel window?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 May, 2021 06:11:09 Top
ewessely




Posts: 55
Joined: 2019-01-31
Hello Andrei,
unfortunately no.
I also tried my luck with worksheet event: ProcessMouseDown does not fire and ProcessBeforeRightClick would work but is the wrong mouse button...

br
Erich
ew
Posted 28 May, 2021 06:25:02 Top
Andrei Smolin


Add-in Express team


Posts: 18219
Joined: 2006-05-11
Hello Erich,

There's the CommandBars.OnUpdate event. In Add-in Express it is mapped to {Excel events component}.CommandbarsUpdate. Check if it occurs when you move the focus from your wizard to Excel.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 May, 2021 08:35:13 Top
ewessely




Posts: 55
Joined: 2019-01-31
Hello Andrei,
you are my hero!
CommandbarsUpdate fires when my wizard is open and I click on a cell. It's exactly what I'm looking for!

It seems that CommandbarsUpdate fires very often when my wizard is not open or does not have the focus. Minimum 1 time /sec. Tried to find out the origin without success. But it seems not to a problem for performance.

Many thanks and have a nice weekend!

Erich
ew
Posted 28 May, 2021 09:55:49 Top