VBA code to know URL validity that will check whether URL is exist or not

你离开我真会死。 提交于 2021-01-29 17:49:01

问题


I have code to know the URL existence but in many other systems or may another office version it is not working. could please help me with this? Where is im doing wrong? Is there an alternate option? Thanks in advance I am using code to know URL VALIDITY is

Public Function IsURLGood(URL As String) As Boolean
Dim request As New WinHttpRequest

On Error GoTo IsURLGoodError
request.Open "HEAD", URL
request.send
If request.Status = 200 Then
    IsURLGood = True
Else
    IsURLGood = False
End If
Exit Function

IsURLGoodError:
IsURLGood = False
End Function

To check URL existence

If IsURLGood(Sheet1.Range("D10")) Then
'MsgBox "correct"
Else
MsgBox "URL is invalid."
    End If

来源:https://stackoverflow.com/questions/58117601/vba-code-to-know-url-validity-that-will-check-whether-url-is-exist-or-not

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!