2017-07-18 116 views

回答

1

你可以使用書籤StartEnd(範圍)屬性來獲取書籤的排序。

Public Sub TestIt() 

    Dim bm1 As Bookmark 
    Dim bm2 As Bookmark 

    Set bm1 = ActiveDocument.Bookmarks("Bookmark1") 
    Set bm2 = ActiveDocument.Bookmarks("Bookmark2") 

    If bm1.Start < bm2.Start Then 
     MsgBox "bm1 is before bm2" 
    ElseIf bm1.Start > bm2.Start Then 
     MsgBox "bm2 is before bm1" 
    Else 
     MsgBox "bm1 and bm2 start at the same place" 
    End If 
End Sub 
+0

如果第二個書籤總是在變化? –

+0

開始/結束屬性值將隨書籤範圍移動而調整,例如添加其他文本。但是,如果要將start屬性保存爲int/long,然後移動書籤範圍,那麼該起始值將會過時並需要更新。 – Fink

相關問題