2

我想只用http://www.someurl.com替换下面的文本。我有 Word mac 2011。澄清一下,我实际上并不想从域代码返回到实际的超链接(蓝色),我只想将地址作为文档中的文本。

{超链接“ http://www.someurl.com ”}

4

1 回答 1

0

像这样(但请注意它不会处理嵌套字段),除非您更改 Word 首选项,否则 Word 将在您开始编辑结果时重新插入链接:

Sub replaceHLs()
Dim hl As Word.Hyperlink
Dim i As Integer
Dim r As Word.Range
Dim strLinkText As String
For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
  With ActiveDocument.Hyperlinks(i)
    Set r = .Range
    strLinkText = .Address
    ' optional, should be OK for HTML links
    If .SubAddress <> "" Then
      strLinkText = strLinkText & "#" & .SubAddress
    End If
    r.Text = strLinkText
    r.Font.Color = wdColorBlue
    r.Font.Underline = wdUnderlineSingle
    Set r = Nothing
  End With
Next
End Sub
于 2013-05-11T08:37:36.040 回答