【发布时间】:2015-02-05 12:04:57
【问题描述】:
我几乎没有视觉基础知识,但我知道这可以通过某种方式完成。 我有一个 144 页的文档,我需要在其中显示 url。 例如:显示“Google”的插入链接现在将显示:“Google (www.google.com)”
此文档中有大约 200 多个链接(最初假设只是电子文档),但现在需要拥有它,以便如果有人手头有打印副本,他们就会知道 URL。我对各种想法持开放态度:(
我的一个想法是按 Alt F9 查看域代码,然后以某种方式进行查找替换并输入某种代码以显示文本和 url 显示?
早些时候,我有一个具有一些视觉基础知识的人试图帮助他发现这个我无法为我运行的东西......是我对如何让它运行缺乏了解吗?
'Private Declare Function GetTickCount Lib "kernel32" () As Long
Public Sub GetHyperlinks()
Dim myDoc As Document
Dim wombat As Hyperlink
' Dim starttime As Long
Dim CurrentDoc As Document
Applicationhttp://images.intellitxt.com/ast/adTypes/icon1.png.ScreenUpdating = False
Set CurrentDoc = ActiveDocument
Set myDoc = Application.Documents.Add()
' starttime = GetTickCount
For Each wombat In CurrentDoc.Hyperlinks
myDoc.Range.InsertAfter wombat.TextToDisplay & vbTab & wombat.Address & vbCrLf
Next
' Debug.Print GetTickCount - starttime
Application.ScreenUpdating = True
myDoc.Range.ParagraphFormat.TabStops.Add CentimetersToPoints(7.5), wdAlignTabLeft, wdTabLeaderSpaces 'basic formatting
End Sub
【问题讨论】: