title: CommandBars("Row").Controls("Delete").OnAction Not Working Anymore
body: <p>Good Morning,</p>
  
  <p>I have the following code to customize the right-click menu in excel.
  It is stored in <strong>"ThisWorkbook"</strong>. <strong>ArchiveRow</strong> sub is stored in <strong><em>Module1.</em></strong> It was all working well at first, then it stopped working completely, and gives a Run-Time </p>
  
  <blockquote>
    <p>Error 5: Invalid Procedure Call or Argument. </p>
  </blockquote>
  
  <p>One minute it's working, the other it's not. Any help is appreciated.</p>
  
  <pre><code>Private Sub Workbook_Open()
  
      Application.CommandBars("Row").Reset
      Application.CommandBars("Column").Reset
      Application.CommandBars("Cell").Reset
  
      With Application.CommandBars("Row")
          .Controls("Delete").OnAction = "ArchiveRow"
          .Controls("Cut").Enabled = False
          .Controls("Hide").Enabled = False
          .Controls("Unhide").Enabled = False
          .Controls("Clear Contents").Enabled = False
          .Controls("Paste").Enabled = False
       End With
  
      With Application.CommandBars("Cell")
          .Controls("Delete").Enabled = False
          .Controls("Cut").Enabled = False
      End With
  
      With Application.CommandBars("Column")
          .Controls("Delete").Enabled = False
          .Controls("Cut").Enabled = False
      End With
  
  End Sub
  </code></pre>
  
  <p>Following sub is called onaction. I dont think the problem is there.</p>
  
  <pre><code>Public Sub ArchiveRow()
      Application.EnableEvents = False
      Selection.Cut
      Sheets("DeletedList").Rows("3:3").Insert Shift:=xlDown
      Selection.Delete
      Application.EnableEvents = True
  End Sub 
  </code></pre>
  
  <p>Commenting out all codes starting with <code>.Controls("Delete")</code> will work.
  It seems any reference to this button causes the error.</p>