标题说:
我有一个excel Sheet,其中包含一个包含超链接的列.现在我想要一个VBA脚本检查哪些超链接已经死亡或工作,并使用文本404错误或活动进入下一列.
希望有人可以帮助我,因为我不擅长VB.
编辑:
我发现@ http://www.utteraccess.com/forums/printthread.php?Cat=&Board=84&main=1037294&type=thread
一个解决方案是单词,但问题是我需要这个Excel的解决方案.有人可以将此转换为Excel解决方案吗?
Private Sub testHyperlinks()
Dim thisHyperlink As Hyperlink
For Each thisHyperlink In ActiveDocument.Hyperlinks
If thisHyperlink.Address <> "" And Left(thisHyperlink.Address, 6) <> "mailto" Then
If Not IsURLGood(thisHyperlink.Address) Then
Debug.Print thisHyperlink.Address
End If
End If
Next
End Sub
Private Function IsURLGood(url As String) As Boolean
' Test the URL to see if it is good
Dim request As New WinHttpRequest
On Error GoTo IsURLGoodError
request.Open "GET", url
request.Send
If request.Status = 200 Then
IsURLGood = …Run Code Online (Sandbox Code Playgroud)