Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

Hide or delete "Add-Ins" in ribbon

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
XP - 25 Jan 2008 20:56 GMT
In XL 2007, I add a program that adds a custom menu item to the shortcut menu
and it works fine.

BUT, two things:

1) A menu item in the ribbon called "Add-Ins" appears. How can I delete or
hide this?

2) In the "Add-Ins" item, the custom shortcut menu item appears 5 times.
Why? [I know this is sort of moot since I want to get rid of "Add-Ins"
anyway, but I'm curious why this happens - at some point I'll probably need
to fix it.]

Thanks for any help on this.
Ron de Bruin - 25 Jan 2008 21:10 GMT
Post the code that create the shortcut

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

> In XL 2007, I add a program that adds a custom menu item to the shortcut menu
> and it works fine.
[quoted text clipped - 10 lines]
>
> Thanks for any help on this.
XP - 25 Jan 2008 21:29 GMT
In this workbook module:

Private Sub Workbook_Activate()
Call ShortCutMenuModify
End Sub

Private Sub Workbook_Deactivate()
Call ShortCutMenuReset
End Sub

In standard module:

Public Function ShortCutMenuModify()
Dim cbBar As CommandBar
Dim lX As Long
On Error Resume Next
For lX = 1 To Application.CommandBars.Count
   If CommandBars(lX).Type = msoBarTypePopup And CommandBars(lX).BuiltIn =
True Then
       Set cbBar = Application.CommandBars(lX)
       With cbBar
           .Controls.Add Type:=msoControlButton, Before:=1
           .Controls(1).Caption = "Custom"
           .Controls(1).FaceId = 5828
           .Controls(1).OnAction = "RunCode"
           If .Controls.Count > 2 Then .Controls(2).BeginGroup = True
       End With
   End If
Next lX
On Error GoTo 0
End Function

Public Function ShortCutMenuReset()
Dim cmdBar As CommandBar
Dim lngX As Long
For lngX = 1 To Application.CommandBars.Count
   If CommandBars(lngX).Type = msoBarTypePopup And
CommandBars(lngX).BuiltIn = True Then CommandBars(lngX).Reset
Next lngX
End Function

At first I thought that maybe 5 menus were affected and therefore, it
appears 5 times, but I counted the items and there are 65 menus affected, so
this has nothing to do with it...

Please let me know if you want me to post my shortcut menu as well...

> Post the code that create the shortcut
>
[quoted text clipped - 12 lines]
> >
> > Thanks for any help on this.
Ron de Bruin - 26 Jan 2008 18:46 GMT
Hi XP

It is on my list to test tomorrow

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

> In this workbook module:
>
[quoted text clipped - 59 lines]
>> >
>> > Thanks for any help on this.
Ron de Bruin - 27 Jan 2008 13:25 GMT
If I use this two testers the problem is only this menu that create the add-in tab
"PivotChart Menu

If I check for it no add-ins tab will be created

Do you see the same results ?

Note : From Jon Peltier in a older thread
It appears in those popups that relate to the worksheet
(such as Cell, Row, Column, etc.) but not in those relating to shapes or
charts, and that is where these enhanced popups are most needed.

Sub AddPopup()
   Dim cb As CommandBar
   Dim ctl As CommandBarButton
   Dim I As Integer
   For Each cb In Application.CommandBars
       If cb.Type = msoBarTypePopup And cb.BuiltIn And cb.Name <> "PivotChart Menu" Then
           I = I + 1
           cb.Reset
           Set ctl = cb.Controls.Add(Type:=msoControlButton)
           ctl.Caption = "MyMenu " & cb.Name
           ctl.FaceId = 80
           ctl.Visible = True
           Debug.Print cb.Name
       End If
   Next
   MsgBox I
End Sub

Sub ResetPopup()
   Dim cb As CommandBar
   Dim ctl As CommandBarButton
   Dim I As Integer
   For Each cb In Application.CommandBars
       If cb.Type = msoBarTypePopup And cb.BuiltIn Then
           I = I + 1
           cb.Reset
       End If
   Next
   MsgBox I
End Sub

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

> Hi XP
>
[quoted text clipped - 63 lines]
>>> >
>>> > Thanks for any help on this.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.