run-time error 2147467259 (80004005)': Method 'Delete' of object'_CommandBarButton' failed

Daniel Schopler 0 Reputation points
2024-01-17T16:23:36.4633333+00:00

I am operating in Excel in Office 2019. I have a routine that sets up multiple CommandBar Buttons. When I click one of those buttons, it calls a different routine, as expected. When the called routine finishes, I want to remove the Created CommandBar Buttons. The delete code is at the end of the running routine. This code will delete all of the created CommandBar Buttons accept the one that calls the currently running routine. When it tries to delete the button that called the routine that is currently running, it gives the above referenced error. How does one resolve that?

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,710 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,737 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.