[RESOLVED] Word Interop Restart Line Numbers - Problem
I spent a couple of hours trying to figure out how to get line numbers on pages to restart in every section. Here is the code I used, before and after the fix.
rng is a Word.Range
Code:
wdSect = Doc.Sections(Doc.Sections.Count)
With wdSect.PageSetup.LineNumbering
.Active = CInt(True)
.StartingNumber = 1
.CountBy = 1
.RestartMode = Interop.Word.WdNumberingRule.wdRestartSection
End With
rng.InsertBreak(Interop.Word.WdBreakType.wdSectionBreakNextPage) 'SECTION BREAK
The issue wasn't the code. The problem was I had a table that started each section. When I inserted a paragraph before the table the code worked.
I suspect there are other 'specials' at the start of a section that might cause the same issue.
The fix was adding this to the beginning of each section, before the table.
Code:
rng.InsertParagraphAfter()
rng.Font.Size = 4
I wanted to post this because I did not find an answer online. Hopefully this answer helps.