我有知道 URL 存在的代码,但在许多其他系统或其他办公版本中它不起作用。可以帮我吗?我在哪里做错了?有替代选择吗?在此先感谢我正在使用代码来知道 URL VALIDITY 是
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
检查 URL 是否存在
If IsURLGood(Sheet1.Range("D10")) Then
'MsgBox "correct"
Else
MsgBox "URL is invalid."
End If