1

I am using word2003 document for processing in my document i have to made link with two string variables (Not in the sense Footnotes and Endnotes)

{Page 1} Best quote from David Brinkley[1]

{Page 6}[1] A successful person is one who can lay a firm foundation with the bricks that others throw at him

I suppose to use Footnote/Endnote for the value [1] to link but it cause some changes while editing the the Footnote/Endnote. Is there any other way to make link between the selected string?

4

1 回答 1

0

可能有很多方法可以做到这一点,但您可以在第 6 页上为文本添加书签,然后在第 1 页上添加指向该书签的超链接。这可以在没有 VBA 代码的情况下完成:

  1. 在第 6 页上选择书签的文本。

  2. 插入/书签

  3. 为书签命名并添加它

  4. 在第 1 页上选择书签的文本。

  5. 插入/超链接

  6. 单击书签按钮并选择列表中的书签

VBA 中的等价物:

Option Explicit

Sub AddHyperlinkToBookmark()
    Dim oBookmark As Bookmark
    Dim oHyperlink As Hyperlink

    '***** Add code to select text for bookmark

    Set oBookmark = ThisDocument.Bookmarks.Add("BookmarkName", Selection.Range)

    '***** Add code to select text for link

    Set oHyperlink = ThisDocument.Hyperlinks.Add(Selection.Range, "", "BookmarkName")

    Set oBookmark = Nothing
    Set oHyperlink = Nothing
End Sub
于 2012-10-19T08:55:32.000 回答