vba 输出所有word书签

Sub 输出所有书签()
    Dim doc As Document
    Set doc = ActiveDocument
    
    Dim bookmark As Bookmark
    
    ' 遍历所有书签
    For Each bookmark In doc.Bookmarks
        Debug.Print "书签名称: " & bookmark.Name & ", 位置: " & bookmark.Range.Start & " 到 " & bookmark.Range.End
    Next bookmark
End Sub

你可能感兴趣的:(vsto,vba)