I am using VBA to set up a document and want to control the styles appearing in the Styles bar in the ribbon.
My approach works for all styles I want except:
Both are built in styles - but other inbuilt styles are appearing using this code. Both are appearing in the expanded (Alt+Ctrl+Shft+S) styles gallery, but not the styles bar in the ribbon.
Any ideas why the two lists don't want to appear in the ribbon gallery?
(I can make them appear there manually but that gives no pointers as nothing is recorded if I record a macro when doing it?!)
here is the code:
-------------------------------
Sub setupGallery()
Dim myStyle As Style
Dim unhide As Variant
Dim inuse As Variant
Dim i As Long
'Start deselecting all - NOTE Visibility = true means doesn't appear
With ActiveDocument
For Each myStyle In .Styles
.Styles(myStyle.NameLocal).Visibility = True
Next myStyle
'Display the desired styles - include the names in oArray
unhide = Array("List Number", "List Bullet", "Heading 1", "Heading 2", "Heading 3", "Heading 4", "Heading 5", "TOC Heading", "Normal") ' the styles I want in the gallery
For i = LBound(unhide) To UBound(unhide)
.Styles(unhide(i)).Visibility = False
Next i
End With
End Sub