Changing Outline Numbering Styles

J

JMS

We subscribe to a service which supplies us with a number different
prewritten documents using outline numbering linked to heading styles,
however they are not in our house style... I need write some code to apply
our style to the pre-configured styles (easy I hear you all say...).
Unfortunately not... In their wisom, when they have created the outline
numbering they have specified the font for the Outline Number. This means
that rather than just changing the normal font and it flow through the
document, it leaves behind the numbering as the original font.

Can anybody suggest some code which will look through all of the Numbering
Galleries linked to a Heading and update the fonts for the numbers.

I tried this

With ListGalleries(wdOutlineNumberGallery).ListTemplates(7).ListLevels(1)
.Font.Name = "Arial"
End With

But this updates the gallery but not the Heading Style linked to it.

Any help would be really appreciated.
 
S

Stefan Blom

If you want to change actual formatting in a document, you must modify the
styles and/or the underlying list templates (numbering schemes); modifying
the list galleries won't do, as you have seen.

Are you saying that you want to modify the font of the headings or just the
font of their outline numbers?

To change the headings, you can use something like this:

For i = 1 To 9
ActiveDocument.Styles("Heading " & CStr(i)).Font.Name = "Arial"
Next i

The above code assumes that we are talking about the built-in heading styles
(in an English language version of Word).

To change the outline numbers themselves, you need to access the underlying
list template *in the document*:

Dim m As ListLevel
With ActiveDocument.Styles(wdStyleHeading1)
For Each m In .ListTemplate.ListLevels
m.Font.Name = "Arial"
Next m
End With

Above, the assumption is that an outline-numbered list have been created
with built-in headings linked to the numbering levels.
 
J

JMS

Hi Stefan

Thanks a lot for your reply it has really helped. It was that second option
that I needed and your code worked first time:

" To change the outline numbers themselves, you need to access the underlying
list template *in the document*:

Dim m As ListLevel
With ActiveDocument.Styles(wdStyleHeading1)
For Each m In .ListTemplate.ListLevels
m.Font.Name = "Arial"
Next m
End With

Above, the assumption is that an outline-numbered list have been created
with built-in headings linked to the numbering levels."

Really appreciate it.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top