I have some word documents that have place holder URL's in them. The URL's are something like "http://<URL>/service.svc". Word has figured that these have to be a valid URL and when the fields get updated, replace them with "Error! Hyperlink reference not valid".
When I mouse over that error text, word pop's up a tooltip still showing the original text. Is there some way to extract the original text? The document is over 80 pages in length. Surely there must be a programmatic way to do this?
I've tried the following code, but it does not seem to find the Hyperlinks in question.
For Each oHyperlink In ActiveDocument.Hyperlinks
If IsObjectValid(oHyperlink) Then
If Len(oHyperlink.Address) > 0 Then
If Mid(oHyperlink.Address, 8, 5) = "<ULR>" Then
oHyperlink.TextToDisplay = oHyperlink.Address
oHyperlink.Range.Font.Color = wdColorBlue
oHyperlink.Range.Font.Underline = wdUnderlineSingle
oHyperlink.Range.Font.UnderlineColor = wdColorBlue
End If
End If
End If
Next oHyperlink
If in the above code sample you remove the line which tests if the item IsObjectValid it comes back with a load of hyperlink stating "Object has been deleted". I'm assuming this could be the broken (by word) "Hyperlinks". How do I get my text back?
Note: This document has been saved and closed so Ctr+z is not an option.
The information is in there, how do I get it?