Wordでハイパーリンクを削除する方法

◆概要

このページは、Wordでハイパーリンクを削除する方法について記載しています。

◆Sample code

Sub RemoveHyperlinks()
'/ハイパーリンクを削除するマクロ
'リンクのみが削除されます。
'ハイパーリンクのテキストは文書に残ります。


     Dim oDoc As Document
     Dim oStory As Range
     Dim oHlink As Hyperlink

     For Each oStory In ActiveDocument.StoryRanges
         For Each oHlink In oStory.Hyperlinks
             oHlink.Delete
         Next
     Next

End Sub

Sub RemoveAllHyperlinks()
'/ハイパーリンクを削除するマクロ
'ハイパーリンクとハイパーリンクのテキストの
'両方を文書からすべて削除します。
Dim oDoc As Document
Dim oStory As Range
Dim oHlink As Hyperlink

     For Each oStory In ActiveDocument.StoryRanges
         For Each oHlink In oStory.Hyperlinks
             oHlink.Range.Delete
         Next
     Next

End Sub
  



▼ページトップへ

/div>