Sub ExportStyles()
Dim St As Object
Application.ScreenUpdating = False
Set wb = ActiveWorkbook
ExpDir = ActiveWorkbook.Path
ExportNm = "my_file.xml"
'Start XML
Set XDoc = CreateObject("MSXML2.DOMDocument")
Set eRoot = XDoc.createElement("Root")
XDoc.appendChild eRoot
'style
Set eWbstyle = XDoc.createElement("WbStyle")
eRoot.appendChild eWbstyle
'ThemeColorScheme
Set eColors = XDoc.createElement("ThemeColorScheme")
eWbstyle.appendChild eColors
For c = 1 To Tm.ThemeColorScheme.count
Set TCS = Tm.ThemeColorScheme(c)
Set eElem = XDoc.createElement("Color")
eElem.Text = TCS.RGB
Set rel = XDoc.createAttribute("ThemeColorSchemeIndex")
rel.NodeValue = TCS.ThemeColorSchemeIndex
eElem.setAttributeNode rel
eColors.appendChild eElem
Next c
'Styles
Set eStyles = XDoc.createElement("Styles")
eWbstyle.appendChild eStyles
For Each St In wb.Styles
If St.BuiltIn = False Then
Set eElem = XDoc.createElement("Style")
eElem.Text = GetFormat(St)
Set rel = XDoc.createAttribute("Name")
rel.NodeValue = St.name
eElem.setAttributeNode rel
eStyles.appendChild eElem
End If
Next St
'FONT
Set eFonts = XDoc.createElement("ThemeFontScheme")
eWbstyle.appendChild eFonts
Set FontMaj = Tm.ThemeFontScheme.MajorFont
Set FontMin = Tm.ThemeFontScheme.MinorFont
Set eElem = XDoc.createElement("MajorFont")
eElem.Text = FontMaj(1).name
eFonts.appendChild eElem
Set eElem = XDoc.createElement("MinorFont")
eElem.Text = FontMin(1).name
eFonts.appendChild eElem
'Save the XML file
XDoc.Save ExpDir & "\" & ExportNm
Application.ScreenUpdating = True
End Sub