I am stuck.
At my organization, we need to check if line numbers are active for a given paragraph. We are attempting to do this but are running into an issue with suppressed line numbers.
We have tried:
Selection.Information(wdFirstCharacterLineNumber)
and
Paragraph.Range.PageSetup.LineNumbers.Active = True
However, the paragraph(s) we are trying to avoid have suppressed line numbers. We are trying to determine whether or not the current paragraph has line numbers.
If line numbers are suppressed LineNumbers.Active
returns True
for the current paragraph. In addition, if line numbers are suppressed then wdFirstCharacterLineNumber
returns 1
for the first paragraph even though it is obviously not 1
as I see 1
in a lower paragraph.
I have not found a function that returns a bool or an integer if line numbers are suppressed for a given paragraph.
I welcome any suggestions. Thank you.
Line numbers are valid for the entire document, which is why what you've tried is returning the information it is.
Line number suppression is direct formatting applied to individual paragraphs, so you need to query the paragraph properties. For example:
If Selection.Paragraphs(1).NoLineNumber Then
'True (-1) means the line numbers are suppressed
Else
'Flase (0) means the line numbers are visible
End If