从显示“错误!”的 MS Word 字段中恢复 URL 超链接引用无效”
我有一些包含占位符 URL 的 Word 文档。 URL 类似于“http://
当我将鼠标悬停在该错误文本上时,会弹出一个工具提示,仍然显示原始文本。 有没有办法提取原文? 该文件长达 80 多页。 当然必须有一种编程方式来做到这一点?
我已经尝试过以下代码,但似乎没有找到有问题的超链接。
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
如果在上面的代码示例中删除了测试项目 IsObjectValid 的行,它将返回一个超链接,说明“对象已被删除”。 我假设这可能是损坏的(按单词)“超链接”。 如何取回我的短信?
注意:此文档已保存并关闭,因此无法使用 Ctr+z。
信息就在那里,如何获取?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否尝试过使用记事本打开文件并搜索http? 这对我有用。
您还可以使用“strings”之类的程序从Word 文件中获取所有文本字符串。 请参阅 http://technet.microsoft.com/en-us/sysinternals/bb897439 .aspx
Have you tried opening the file with Notepad and searching for http? This works for me.
You can also use a program like "strings" to get all of the text strings from the Word file. See http://technet.microsoft.com/en-us/sysinternals/bb897439.aspx
怎么样:
How about:
我刚刚遇到了同样的问题,并通过使用 LibreOffice 打开文档来解决该问题。
很抱歉,我在 Word 选项中找不到任何内容来打开或恢复此内容(MacOS 12 上的 Word v16.61)。
I just had the same problem and worked around the problem by opening the document with LibreOffice.
I'm sorry I could not find anything in options of Word to open or revert this (Word v16.61 on MacOS 12).