【发布时间】:2016-02-26 06:13:51
【问题描述】:
我正在寻求帮助,因为我有大量链接来检查链接是否损坏我已经尝试了下面的宏,但它工作了两次,之后它不再工作我正在使用 ms office 10 64bit 我想如果宏添加宏 可以检查图像分辨率,例如,如果我在 A 列上粘贴 url,它将突出显示损坏的链接,在 b 列上它将显示图像分辨率
Sub Audit_WorkSheet_For_Broken_Links()
If MsgBox("Is the Active Sheet a Sheet with Hyperlinks You Would Like to Check?", vbOKCancel) = vbCancel Then
Exit Sub
End If
On Error Resume Next
For Each alink In Cells.Hyperlinks
strURL = alink.Address
If Left(strURL, 4) <> "http" Then
strURL = ThisWorkbook.BuiltinDocumentProperties("Hyperlink Base") & strURL
End If
Application.StatusBar = "Testing Link: " & strURL
Set objhttp = CreateObject("MSXML2.XMLHTTP")
objhttp.Open "HEAD", strURL, False
objhttp.Send
If objhttp.statustext <> "OK" Then
alink.Parent.Interior.Color = 255
End If
Next alink
Application.StatusBar = False
On Error GoTo 0
MsgBox ("Checking Complete!" & vbCrLf & vbCrLf & "Cells With Broken or Suspect Links are Highlighted in RED.")
End Sub
【问题讨论】:
-
很确定您不会从 HEAD 请求中获得分辨率(您的意思是尺寸吗?)。
-
当你说它工作两次时,你的意思是它只工作两次吗?或者,如果您退出并重新打开 Excel,是否可以再次运行宏?
-
如果我无法获得解决方案,我很好,我的下一个任务是删除死链接请帮助我希望这个宏突出显示死链接
-
是的,它只工作了两次,再也不能工作了
-
注释掉
On Error Resume Next这一行,看看是否有任何错误产生