Listing Styles

  • Thread starter Thread starter dan
  • Start date Start date
D

dan

I want to list all the styles that I have in a template,
along with each styles' settings for an instruction
page. Is that possible? Or do I have to start from
scratch? I can't even find a way to copy the list of
style names.

Excel XP 2002
Win XP
 
I don't know of a built in feature that will list the styles, but you
could create your own from code, e.g.:

'==============================
Sub MyStyles()
Dim st As Style
Dim i As Integer
Dim ws As Worksheet
Set ws = Worksheets.Add
ws.Name = "StyleList"
With ws
.Rows("1:1").Font.Bold = True
i = 2
'add headings
.Cells(1, 1).Value = "Style"
.Cells(1, 2).Value = "AddIndent"
.Cells(1, 3).Value = "BorderLine"
.Cells(1, 4).Value = "Builtin"
.Cells(1, 5).Value = "FontName"
.Cells(1, 6).Value = "HAlign"
.Cells(1, 7).Value = "FillColour"
.Cells(1, 8).Value = "Locked"

For Each st In ActiveWorkbook.Styles
.Cells(i, 1).Value = st.Name
.Cells(i, 2).Value = st.AddIndent
.Cells(i, 3).Value = st.Borders.LineStyle
.Cells(i, 4).Value = st.BuiltIn
.Cells(i, 5).Value = st.Font.Name
.Cells(i, 6).Value = st.HorizontalAlignment
.Cells(i, 7).Value = st.Interior.ColorIndex
.Cells(i, 8).Value = st.Locked
i = i + 1
Next
End With
End Sub
'====================================

Also, Leo Heuser has some code for listing used and unused styles:

http://groups.google.com/groups?&threadm=usqTgCoN$GA.253@cppssbbsa05
 
Back
Top