I am currently having alot of trouble finding a way to automatically change List styles across a Word document.
What i mean by this is, you have a document with a Paragraph, then a Numbered list, then a paragraph e.t.c
I want to be able to change the Style of the Numbering used in the numbered list across a document, without affecting the other non list paragraphs.
I have been searching the various methods available in WORD VBA and have so far i can update the entire document with a style as well as change the Font e.t.c, BUT AM UNABLE TO JUST UPDATE THE LISTS!
My Code
VB Code:
dim objWord as Word.Application Dim NoPages as Long objWord.Selection.MoveEnd 6, Count:=1 NoPages = objWord.Selection.Information(wdNumberOfPagesInDocument) objWord.Selection.MoveEnd 6, Count:=NoPages With objWord.Selection .Font.Name = "Arial" .Font.Size = 10 .ParagraphFormat.LineSpacing = 20 '.ParagraphFormat.Style = "HL LEGAL" End With
I then tried to cycle through all the Paragraphs and change the style that way, and then i discovered, even if a line is part of a numbered list, its STYLE can still be NORMAL and not NUMBERED which doesn't help me at all.
VB Code:
For Each Paragraph In objWord.ActiveDocument.Paragraphs If Paragraph.Style <> "HL legal" Then If Paragraph.Style = "Numbered" Then 'change style End If End If Next
So what i need is someway to Detect if a line is part of a numbered list and to then change to a different Numbering Style ????
I will be eternally gratefull if anybody has an answer to this as it has been doing my head in !!!!




Reply With Quote