我们如何在word文档中为编号列表添加书签 [英] How Do we Bookmark the Numbered List in word document
问题描述
我正在尝试将word文档中的编号列表(自动编号)加入书签,但是无法这样做我如何为编程书签
嗨Kiran.s,
为什么要为编号列表添加书签?您可以访问类似的主题:
如何在MS word中为自动数字添加书签
我建议你在已编号的段落的开头。您可以遍历word文档中的所有段落并返回其
ListFormat.ListString 。如果段落是编号列表段落,则会返回列表 字符串,否则它将返回""。我们可以根据ListFormat.ListString的长度添加书签。以下是示例。
子测试()
Dim rng As Range
Dim para As Paragraph
设置rng = ActiveDocument.Range
For the para in rng.Paragraphs
如果Len(para) .Range.ListFormat.ListString)> 0然后
ActiveDocument.Bookmarks.Add _
名称:=" BK" &安培; ActiveDocument.Bookmarks.Count,_
范围:= ActiveDocument.Range(para.Range.Start,para.Range.Start)
结束If
下一段
End Sub
最好的问候,
特里
I am trying to bookmark the numbered list (Auto number) in word document however not able to do so how do i bookmark programmatic
Hi Kiran.s,
Why do you want to bookmark the numbered list? You could visit the similar thread: How to bookmark Auto Numbers in MS word
I suggest you bookmark at the start of the paragraph which was been numbered. You could iterate through all paragraphs in the word document and return its ListFormat.ListString. If the paragraph is numbered list paragraph, it will return the list string, otherwise it will return "". We could add bookmarks according the length of the ListFormat.ListString. Here is the example.
Sub Test()
Dim rng As Range
Dim para As Paragraph
Set rng = ActiveDocument.Range
For Each para In rng.Paragraphs
If Len(para.Range.ListFormat.ListString) > 0 Then
ActiveDocument.Bookmarks.Add _
Name:="BK" & ActiveDocument.Bookmarks.Count, _
Range:=ActiveDocument.Range(para.Range.Start, para.Range.Start)
End If
Next para
End Sub
Best Regards,
Terry
这篇关于我们如何在word文档中为编号列表添加书签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!