Option
Explicit
Sub
Bsp()
Dim
objHyperlink
As
Word.Hyperlink
Dim
blnIgnoreExt
As
Boolean
Dim
n
As
Long
With
ThisDocument
For
Each
objHyperlink
In
.Hyperlinks
If
objHyperlink.Address <>
""
Then
If
Not
blnIgnoreExt
Then
If
vbCancel = MsgBox(
"Externe Links werden nicht berücksichtigt."
& vbNewLine & vbNewLine & _
"('"
& objHyperlink.Address &
"')"
& vbNewLine & vbNewLine & _
"(Abbrechen = nachfolgende Fälle nicht mehr melden)"
, _
vbExclamation
Or
vbOKCancel, _
"ACHTUNG"
) _
Then
blnIgnoreExt =
True
End
If
End
If
Else
If
objHyperlink.SubAddress <>
""
Then
If
Not
.Bookmarks.Exists(objHyperlink.SubAddress)
Then
Call
objHyperlink.Range.Delete
n = n + 1
End
If
End
If
End
If
Next
End
With
Call
MsgBox(
"Es wurden "
& n &
" Hyperlinks auf ungültige Textmarken entfernt."
, _
vbInformation)
End
Sub