COMMAND BAR - need to change a personal menu bar

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,790
Office Version
  1. 2016
Platform
  1. Windows
I had someone build a menu bar for me. I now want to change and delete a couple of buttons on it.

When go to the Customize menu and select a button to delete it comes back when I reopen the file?

I have commented out a couple of VBA lines, such as ".protection = msoBarNoChangeVisible" and "Application.CommandBars("Toolbar List").Enabled = False." I don't think these lines are the problem but don't know VBA enough to know ...
This message was edited by em on 2002-10-18 11:36
This message was edited by em on 2003-02-09 17:20
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I would guess that the procedure built for you creates the menu bar when the spreadsheet opens. Go into VBA Editor (Alt-F11) and find the "This Workbook" Object in here there should be a statement something along the lines of:

Application.Commandbars("Personal Menu Bar
Name").Add

Then something like:

Application.Commandbars("Personal Menu Bar Name").controls.Add(msocontrolbutton)
followed by various caption and formatting details. This should be what you need to change.

Good luck and hope this helps.

Jim
 
Upvote 0
Jim -- yea I thought it would be in the VBE but I can't find any lines where it is being added. Below is code from the "OnAction" macro and the answer probably is in here some where, maybe the "strName" or "strActionName"--I just haven't figured it out yet ??

Sub GetAllCL()
On Error Resume Next

Set cbMenu = Application.CommandBars("EM").Controls("Cover Letters")

'Delete existing ones.
For Each cControl In cbMenu.CommandBar.Controls
cControl.Delete
Next

strActionName = ThisWorkbook.Name & "!GoToCLSheet"

'then add all meeting criteria
For Each wSheet In Worksheets
If Right(wSheet.Name, 2) = "CL" Then
'Remove the suffix
strName = WorksheetFunction.Substitute(UCase(wSheet.Name), " - CL", "")
cbMenu.Controls.Add().Caption = strName
cbMenu.Controls(strName).OnAction = strActionName
End If
Next

cbMenu.Controls.Add().Caption = Sheet32.Name
strActionName = ThisWorkbook.Name & "!GoToIntro"
cbMenu.Controls(Sheet32.Name).OnAction = strActionName
Run "KillVariables"
On Error GoTo 0
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,270
Messages
6,177,574
Members
452,784
Latest member
talippo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top