Cell EditMode and TaskPane

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

Cell EditMode and TaskPane
 
Subscribe
Andre Herrmann




Posts: 11
Joined: 2022-11-05
Hello,

is there any reliable way to disable clicking on an Excel taskpane as long as the user is in cell edit mode?

We were able to track whether a user is editing or not by using below code. And we also found other useful links like this: https://www.add-in-express.com/creating-addins-blog/excel-check-user-edit-cell/.

        
        public bool InCellEditMode = false;
        private void TaskPaneControl_ADXBeforeCellEdit(object sender, ADXBeforeCellEditEventArgs e)
        {
            Log.Information("Before Cell Edit");
            InCellEditMode = true;
        }

        private void TaskPaneControl_ADXAfterCellEdit(object sender, ADXAfterCellEditEventArgs e)
        {
            Log.Information("After Cell Edit");
            InCellEditMode = false;
        }


However, we struggle to disable the taskpane as long as the user is in editmode. We would like to push the focus back to excel. Let the user finish the cell editing and disable any interaction with our taskpane.

We tried this:

        private void TaskPaneControl_ADXEnter(object sender, ADXEnterEventArgs e)
        {
            if(InCellEditMode)
            {
                MessageBox.Show("You are currently editing a cell. Please finish editing before interacting with the task pane.");
                SetFocusToExcel(); //https://www.add-in-express.com/forum/read.php?FID=1&TID=3616
                return; // Do not set focus if in cell edit mode
            }
        }


This works fine for the first time the user clicks on the taskpane. But unfortunately, ADXLeave is not triggered and therefore the second click no longer triggers ADX_Enter.

Any help is highly appreciated.

Best regards,
Andre
Posted 25 Jul, 2025 10:32:38 Top
Andrei Smolin


Add-in Express team


Posts: 19169
Joined: 2006-05-11
Hello Andre,

In these events, you can change Enabled = false/true on some top-level control on your pane. In some scenarios, we use the Windows API function EnableWindow which accepts a control's handle (see Control.Handle).

Regards from Poland (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Jul, 2025 07:19:32 Top
Andre Herrmann




Posts: 11
Joined: 2022-11-05
Thanks, Andrei!

That was helpful. We followed the advice and changed the Enable property.

Best regards,
Andre
Posted 11 Aug, 2025 16:06:41 Top
Andrei Smolin


Add-in Express team


Posts: 19169
Joined: 2006-05-11
You are welcome!

Regards from Poland (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 12 Aug, 2025 18:36:30 Top