1

I have this .xlsm file with a custom Ribbon. It has 8 buttons assigned to custom macros. Is there a way to extract the custom Ribbon into an .xlam? If not, is there any way to open that custom Ribbon from another .xlsm?

2

2 Answers 2

2

I am using this code to extract the CustomUI file from the Excel-File. It creates a copy of the file from which then the customUI14.xml file gets extracted. Assumption: C:\Program Files\7-Zip\7z.exe is available

I added this piece of code to sourcetools.xla to not only extract the modules but also the customUI for versioning.

Public Sub extractCustomUIToFolder(wb As Workbook, pathTarget As String)
    Dim tmp As String
    tmp = wb.Path & "~temp.xlsm"
    wb.SaveCopyAs tmp

    Dim strShellString As String

    strShellString = "e " & Chr$(34) & tmp & Chr$(34) & _
                     " -o" & Chr$(34) & pathTarget & "\" & Chr$(34) & _
                     " customUI14.xml -r -aoa"
                     
    Dim exePath As String
    exePath = Chr$(34) & "C:\Program Files\7-Zip\7z.exe" & Chr$(34) & " "
    
    Call Shell(exePath & strShellString)
    
    Kill tmp
End Sub

Using the according commands it is also possible to "re-import" the customUI14.xml file into the xlam

-2

The only documentation I can find about importing and exporting custom ribbons is here

and here

  1. Click File
  2. Select Options.
  3. Select Customize Ribbon.
  4. Select Import/Export.
  5. Select Export all Customizations.
  6. Choose a destination and file name in the File Save window.
  7. Click Save to finish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.