I can get this ribbon to work on my excel 2016, but when i sent it as an .xlam file to another computer as an add-in, it doesn't work. I have check their macro settings etc but just doesn't seem to run. If i change the code to the old excel ribbon, it works on their computer. Can someone have a look whether its the code or their pc settings? I got this code off the web so i dono why it only works on my PC. I even created from scratch on their pc as code and it didn't work either.
In ThisWorkbook:
PHP:
Sub LoadCustRibbon()
<mso:customui =""="" xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui"><mso:ribbon><mso:qat><mso:tabs><mso:tab id="reportTab" label="Macros" insertbeforeq="mso:TabFormat"><mso:group id="reportGroup" label="Reports"><mso:button id="Formula" label="Formulas" "="" &="" vbnewline="" =""="" 'new="" button
Dim hFile As Long
Dim path As String, fileName As String, ribbonXML As String, user As String
hFile = FreeFile
user = Environ("Username")
path = "C:\Users" & user & "\AppData\Local\Microsoft\Office"
fileName = "Excel.officeUI"
ribbonXML = "<mso:customui xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui">" & vbNewLine
ribbonXML = ribbonXML + " <mso:ribbon>" & vbNewLine
ribbonXML = ribbonXML + " <mso:qat>" & vbNewLine
ribbonXML = ribbonXML + " <mso:tabs>" & vbNewLine
ribbonXML = ribbonXML + " <mso:tab id="reportTab" label="Macros" insertbeforeq="mso:TabFormat">" & vbNewLine
ribbonXML = ribbonXML + " <mso:group id="reportGroup" label="Reports">" & vbNewLine 'autoScale='true'
ribbonXML = ribbonXML + " <mso:button id="Formula" label="Formulas" "="" &="" vbnewline="" 'new="" button
ribbonXML = ribbonXML + "imageMso='CacheListData' size='large' onAction='Myformula'/>" & vbNewLine
</mso:button></mso:group><mso:group id="MacrosGroup" label="Macros"><mso:button id="ManningR" label="Manning Matrix" "="" &="" vbnewline="" 'new="" button
<mso:button id="Test" label="Testing" "="" &="" vbnewline="" 'new="" button
ribbonXML = ribbonXML + " </mso:button></mso:button></mso:group>" & vbNewLine
ribbonXML = ribbonXML + " </mso:tab>" & vbNewLine
ribbonXML = ribbonXML + " </mso:tabs>" & vbNewLine
ribbonXML = ribbonXML + " </mso:qat></mso:ribbon>" & vbNewLine
ribbonXML = ribbonXML + "</mso:customui>"
ribbonXML = Replace(ribbonXML, """", "")
Open path & fileName For Output Access Write As hFile
Print #hFile, ribbonXML
Close hFile
End Sub
PHP:
Sub ClearCustRibbon()
Dim hFile As Long
Dim path As String, fileName As String, ribbonXML As String, user As String
hFile = FreeFile
user = Environ("Username")
path = "C:\Users\" & user & "\AppData\Local\Microsoft\Office\"
fileName = "Excel.officeUI"
ribbonXML = "<mso:customui ="" xmlns:mso="" http:="" schemas.microsoft.com="" office="" 2009="" 07="" customui""="">" & _
"<mso:ribbon></mso:ribbon></mso:customui>"
Open path & fileName For Output Access Write As hFile
Print #hFile, ribbonXML
Close hFile
End Sub
In ThisWorkbook:
Code:
Private Sub Workbook_Open()
LoadCustRibbon
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ClearCustRibbon
End Sub
Last edited by a moderator: