Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying the normal style does not change the font for the numbering

Status
Not open for further replies.

rdjmorgan

Programmer
Jan 31, 2002
11
0
0
GB
Hi

Please excuse me if this has been asked before but I have trawled many places now and can't find a satisfactory answer. I hope you guys can help me.

The problem is this:

We download word documents from a website and then need to format them to our house font style. So as all the styles seem to be based on normal I ask everyone to modify the normal style to our font. This is great apart from the styles that have numbering. Although they state they are based on the normal font they do not change.

Is there something I am missing? Is it possible to write some vba that would modify the normal font and also the numbering to our font? If so could someone point me in the right direction. Just to say I can write basic vba but am more used to recording a macro and modifying it later.

Any help would be greatly appreciated and could save a lot of time.

Many thanks

Jay
 
The auto-numbering font (assuming that's what it is) has nothing to do with the Normal Style. To change it, you could use a macro like the following. However, you'll need to specify the appropriate list level (of which there are nine).
Code:
Sub Demo()
  With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(1)
    .NumberFormat = "%1"
    With .Font
      .Bold = True
      .Italic = False
      .StrikeThrough = wdUndefined
      .Subscript = wdUndefined
      .Superscript = wdUndefined
      .Shadow = wdUndefined
      .Outline = wdUndefined
      .Emboss = wdUndefined
      .Engrave = wdUndefined
      .AllCaps = wdUndefined
      .Hidden = wdUndefined
      .Underline = wdUndefined
      .Color = wdUndefined
      .Size = 10
      .Animation = wdUndefined
      .DoubleStrikeThrough = wdUndefined
      .Name = "Arial"
    End With
  End With
  Selection.Range.ListFormat.ApplyListTemplateWithLevel ListTemplate:= _
    ListGalleries(wdOutlineNumberGallery).ListTemplates(1), _
    ContinuePreviousList:=False, ApplyTo:=wdListApplyToWholeList, _
    DefaultListBehavior:=wdWord10ListBehavior
End Sub

Cheers
Paul Edstein
[MS MVP - Word]
 
Hi Paul

Thanks for your help.

The documents I have seem to have various list levels. Is there are way to find out which listtemplate and listlevels are being used?

I only need to reset the font name so presume I could remove all the bold italics etc.

I am also happy with the numberformat that is set, do I need to have that in as well or is it just good practice?

Just thinking about it could a macro loop through each listtemplate / listlevel and set the font. Tell me if I am being stupid with my questions :)

Jay
 
Without knowing what Styles or numbering formats you're looking for, it's hard to be specific. Perhaps you could do something like:
Code:
Sub Demo()
Dim i As Long, StrLvl As String, oPara As Paragraph
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1)
  For i = 1 To 9
    StrLvl = StrLvl & "%" & i & "."
    With .ListLevels(i)
      .NumberFormat = StrLvl
      .ResetOnHigher = i - 1
      .StartAt = 1
      .LinkedStyle = "Heading " & i
    End With
  Next
End With
For Each oPara In ActiveDocument.Paragraphs
  With oPara
    If .Range.ListFormat.ListString <> "" Then '.ListLevelNumber
      .Range.ListFormat.ApplyListTemplate _
        ListTemplate:=ListGalleries(wdOutlineNumberGallery) _
        .ListTemplates(1)
      .Style = "Heading " & .Range.ListFormat.ListLevelNumber
    End If
  End With
Next
End Sub

Cheers
Paul Edstein
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top