Ribbon macro not working on other computers

spoony40

New Member
Joined
Feb 27, 2015
Messages
17
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.

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:

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,214,584
Messages
6,120,385
Members
448,956
Latest member
JPav

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