Copy "Delete Rows" control to Standard Toolbar

  • Thread starter Thread starter Doug Glancy
  • Start date Start date
D

Doug Glancy

Win XP, XL2k

In Excel, from Customize > Commands I can drag a "Delete Rows" control from
the Edit category up to the Standard toolbar. I've been trying to replicate
this in code. I know how to copy a control from the Edit toolbar with code,
but when I do this the resulting control does is called Delete and clicking
it takes you to the userform that prompts whether to shift up, etc. It has
the same ID as the one that I get from customize (293) but a different
caption (Delete v. Delete Rows), and it does not behave as the one from
Customize. The one from Customize, when clicked, deletes the selection rows
without any prompts.

Can anyone tell me how to get this "Delete Rows" control onto a toolbar with
code?

Thanks,

Doug
 
this works for me:

With CommandBars("Standard").Controls
.Add Type:=msoControlButton, Id:=293, Before:=.Count - 1
End With
 
JE,

It works. And you also answered my more general question about a cleaner
syntax for adding than what I was using, which was copying from another bar.

Thanks a lot,

Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top