![]() |
How to handle all delete row events in excel
I want to handle all row deletes within Excel 2003. I have no trouble
with Worksheet Menu Bar/Edit/Delete because it is always there, but what about the context dependant items like Worksheet Menu Bar/Edit/&Delete Ro&w and Cell/&Delete/&Row These menu items appear in Excel when the selection is within a listobject. If I try to point a CommandBarButton to these items, I get "The parameter is incorrect" error, possibly because they don't exist in the menu at the time I am trying to create the object. If so, when can I do this? Not within the BeforeRightClick event for the sheet ( I have tried). I don't see an AfterRightClick event or a MouseUpEvent within the Excel Object Model. I've reference KB213552 List of ID numbers for built-in CommandBar controls in Excel 2000 without luck. I tried CommandBarControl Row CommandBarButton Delete, but this produced the "Parameter is incorrect" error. The following works: Dim mainCtr As Office.CommandBar mainCtr = DirectCast(m_xlApp.CommandBars("Worksheet Menu Bar"), Office.CommandBar) Dim ctr As Office.CommandBarPopup ctr = DirectCast(mainCtr.Controls("Edit"), Office.CommandBarPopup) mnuEditDelete = DirectCast(ctr.CommandBar.Controls("&Delete..."), Office.CommandBarButton) But this does not: mnuEditDeleteRow = DirectCast(ctr.CommandBar.Controls("Delete Ro&w"), Office.CommandBarButton) As an aside, I have not had problems with KB823988 and deletion of rows within list (entire row is selected) - for the one menu item I am able to handle. I appreciate any insight on this topic Thanks Tom Hughes |
All times are GMT +1. The time now is 05:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com