View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Delete/Remove Button

Going through the buttons collection:

Option Explicit
Sub testme()

Dim BTN As Button
Set BTN = ActiveSheet.Buttons(Application.Caller)

'your code to do real stuff
MsgBox "hi"

BTN.Delete

End Sub

If you think that you'll ever need that button again, you may just want to hide
it (btn.visible = false)


Jwil wrote:

Hi,

Thank you for the replies. Maybe I wasn't as clear with my question.
I need to remove the button within the Macro.
So the scenario goes like this.:
The user hits the button and the macro runs.
After the macro the button goes away so the user doesn't
hit the button again. and so that the worksheet can be saved without
a button in it.

Thanks

"FSt1" wrote:

hi
you need to be in design mode to do that.

regards
FSt1

"JMay" wrote:

Right Click the Button - from the short-Cut menu select "Cut"; Done


"Jwil" wrote:

I want to call or assign a macro using a command button or a button from the
forms toolbar. How do I remove or delete the button using VBA after the
macro it called is done? It doesn't really matter which button I have to use.

Thanks


--

Dave Peterson