I have a toolbar with macros that are activated by buttons.
How would I go about writing code that would remove the button from the toolbar after the user has clicked the button?
Regards
I have a toolbar with macros that are activated by buttons.
How would I go about writing code that would remove the button from the toolbar after the user has clicked the button?
Regards

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
You can manipulate buttons on toolbars via the Application.CommandBars collection.
If you know the name of the Toolbar and of the button then this is fairly simple
<code>Application.CommandBars("My Toolbar").Controls("My &Button").Delete</code>
You would include this code somewhere in the macro that is called when the button is clicked.
Depending on why you are deleting the button it may be easier to change its Visible or Enabled property to False, this would make it easier to reinstate the button when you need it again.
StuartR
I agree with Stuart concerning using Visible or Enabled instead of deleting the button. In addition to his reply: whatever you use, this changes the commandbar and makes the container of the toolbar "dirty". Causing a messagebox to appear asking if you want to save this container. To avoid this, put a line of code immediately after the Delete/Visible/Enable line:
NormalTemplate.Saved = True
or
ActiveDocument.AttachedTemplate.Saved = True
depending where you store the toolbar.