excel - 用于了解 URL 有效性的 VBA 代码将检查 URL 是否存在
问题描述
我有知道 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
解决方案
推荐阅读
- javascript - 如果在 Angular 超时中返回 false,则重试函数调用
- typescript - 如何导出可以从浏览器命令行访问的打字稿功能?
- ionic-framework - 带有ionic3的谷歌分析不适用于ios
- hyperledger-fabric - 如何集成 Hyperledger Fabric 网络和 Hyperledger Composer
- opencv - 为什么即使在我的树莓派 3 上安装了 openalpr 后,我也会收到 alpr 错误?
- c - 为什么 strcpy 在写入较短的数组时不会导致分段错误?
- java - 已为此响应调用 Tomcat 8.5 response.getWriter()
- android - Android如何用rows和col span实现这种类型的布局
- java - 错误:收缩时发现警告,请使用 -dontwarn 或 -ignorewarnings 抑制它们
- javascript - 无法按在 Object.keys() 中可见的名称访问对象属性