[AccessD] Remove a custom toolbar

Darryl Collins Darryl.Collins at coles.com.au
Wed Oct 8 17:42:24 CDT 2008



Arthur,

If it is a commadbar style toolbar created in code you can use this to remove it

On Error Resume Next
CommandBars("My Toolbar Name").Delete
On Error GoTo 0

Otherwise you can try

Right Mouse Click in Access on the gray toolbar line
When the customise button opens up select the toolbar in question and press delete.

If the code is rebuilding it though, it will just reappear.

Here is the code i use to make a custom toolbar in Access. Look for similar.

'==========================================================
Sub CreateNavigationToolbar()

Dim cmdbarNavigation As CommandBar

' Destroy the existing toolbar if exists
On Error Resume Next
CommandBars("Navigation Toolbar").Delete
On Error GoTo 0

' Create the toolbar
Set cmdbarNavigation = CommandBars.Add(Name:="Navigation Toolbar", _
            Position:=msoBarBottom, _
            Temporary:=True)

With cmdbarNavigation
    .Controls.Add Type:=msoControlButton, id:=1786 '1 Close
    .Controls.Add Type:=msoControlButton, id:=154 '2 GotoFirst
    .Controls.Add Type:=msoControlButton, id:=155 '3 GotoPrev
    .Controls.Add Type:=msoControlButton, id:=156 '4 GotoNext
    .Controls.Add Type:=msoControlButton, id:=157 '5 GotoLast
    .Controls.Add Type:=msoControlButton, id:=539 '6 New
    .Controls.Add Type:=msoControlButton, id:=530 '7 Duplicate
    .Controls.Add Type:=msoControlButton, id:=644 '8 Delete
    .Visible = True
End With


'-- Define the Close button
With cmdbarNavigation.Controls(1)
  .Style = msoButtonIconAndCaption
  .Caption = "Close Form"
  .OnAction = "CloseActiveForm"
  .TooltipText = "Close Form"
End With

'-- Define the Duplicate button
With cmdbarNavigation.Controls(7)
  .Style = msoButtonIcon 'AndCaption
  '.Caption = "Duplicate"
  .OnAction = "DuplicateRecord"
  .TooltipText = "Duplicate Active Record"
End With

Set cmdbarNavigation = Nothing

End Sub
'======================================================================







-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller
Sent: Thursday, 9 October 2008 1:31 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Remove a custom toolbar


I added a custom toolbar and now I want to remove it, but cannot figure out
how. Simply remove its module? Or is more required?

TIA,
Arthur
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

This email and any attachments may contain privileged and confidential information
and are intended for the named addressee only. If you have received this e-mail in
error, please notify the sender and delete this e-mail immediately. Any
confidentiality, privilege or copyright is not waived or lost because this e-mail
has been sent to you in error. It is your responsibility to check this e-mail and
any attachments for viruses.  No warranty is made that this material is free from
computer virus or any other defect or error.  Any loss/damage incurred by using this
material is not the sender's responsibility.  The sender's entire liability will be
limited to resupplying the material.





More information about the AccessD mailing list