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?
CodePudding user response:
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
CodePudding user response:
The only documentation I can find about importing and exporting custom ribbons is here
and here
- Click File
- Select Options.
- Select Customize Ribbon.
- Select Import/Export.
- Select Export all Customizations.
- Choose a destination and file name in the File Save window.
- Click Save to finish.