Where does this file's custom ribbon tab come from?

muse43

New Member
Joined
Feb 24, 2019
Messages
6
Hi,

I am trying to replicate the behavior of an .xlsm file I have. When I open it, I have a custom tab showing. However, if I go into the "customize ribbon" section, it's not there. There also doesn't seem to be any macro running on the workbook open event. Also looked in quick access toolbars and there's nothing... how is this happening??? Any other ways of getting a custom tab to show up (just for that 1 file and on any computer it is opened on)?

Thanks!


PS
I'd attach the file but it's my first post and I don't see an option for attachments (??)

I've also posted this on another forum but no reply so trying here. Here's the link to my other post:
https://www.excelforum.com/excel-pr...s-this-files-custom-ribbon-tab-come-from.htmlom.html


 
@muse43
you might find some of this customUI useful

https://pastebin.com/raw/53CczGhd

and the module to go with it
Code:
'Callback for Label1 getLabel
Sub getLabel1(control As IRibbonControl, ByRef returnedVal)
returnedVal = "Hello " & Application.UserName
End Sub




'Callback for Label2 getLabel
Sub getLabel2(control As IRibbonControl, ByRef returnedVal)
returnedVal = "Today is " & Date
End Sub




'Callback for EditBox1 onChange
Sub EditBox1_Change(control As IRibbonControl, text As String)
Dim squareRoot As Double
On Error Resume Next
squareRoot = Sqr(text)
If Err.Number = 0 Then
MsgBox "The square root of " & text & " is: " & squareRoot
Else
MsgBox "Enter a positive number.", vbCritical
End If
End Sub




'Callback for Button1 onAction
Sub ShowCalculator(control As IRibbonControl)
On Error Resume Next
Shell "calc.exe", vbNormalFocus
If Err.Number <> 0 Then MsgBox "Can't start calc.exe"
End Sub








'Callback for ToggleButton1 getPressed
Sub ToggleButton1_Click(control As IRibbonControl, ByRef returnedVal)
MsgBox "Toggle value: " & returnedVal
End Sub








'Callback for Checkbox1 onAction
Sub Checkbox1_Change(control As IRibbonControl, pressed As Boolean)
MsgBox "Checkbox value: " & pressed
End Sub




'Callback for Combo1 onChange
Sub Combo1_Change(control As IRibbonControl, text As String)
MsgBox text
End Sub




'Callback for Gallery1 onAction
Sub MonthSelected(control As IRibbonControl, _
id As String, index As Integer)
MsgBox "You selected " & id
End Sub




'Callback for Today onAction
Sub ShowToday(control As IRibbonControl)
MsgBox "Today is " & Date
End Sub




'Callback for gallery2 onAction
Sub OnAction(control As IRibbonControl, id As String, index As Integer)
MsgBox "You clicked Banjo Photo #" & index + 1
End Sub
Sub Macro1(control As IRibbonControl)
' Executed when Sheet1 is active
MsgBox "Greetings from the Sheet1 Macro", vbInformation
End Sub




Sub Macro2(control As IRibbonControl)
' Executed when Sheet2 is active
MsgBox "Hello from the Sheet2 Macro", vbCritical
End Sub




Sub Macro3(control As IRibbonControl)
' Executed when Sheet3 is active
MsgBox "Aloha from the Sheet3 Macro", vbQuestion
End Sub

can add combobox / toggle / dropdown etc... also

d7db128ee2.png
</button
</button></editbox></labelcontrol></labelcontrol></group></tab></tabs></ribbon></customui>
 
Last edited:
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
this to activate custom ribbon ******

Code:
Sub RibbonUI******(ribbon As IRibbonUI)

    On Error Resume Next 'Don't break on workbook opening


    If Val(Application.Version) >= 14 Then
        ribbon.ActivateTab "MyStuff"
    Else
        Application.OnTime Now(), "ActivateTab"
    End If


End Sub

on load censored for some reason
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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