Sau*_*aul 20 vba ms-word httprequest
我正在尝试将Word文档中的数据发送到网页.我找到了一些代码,将其粘贴到一个新模块中并保存.当我运行它时,我得到"编译错误,用户定义的类型未定义"
我的代码:
Sub http()
Dim MyRequest As New WinHttpRequest
MyRequest.Open "GET", _
"http://www.google.com"
' Send Request.
MyRequest.Send
'And we get this response
MsgBox MyRequest.ResponseText
End Sub
Run Code Online (Sandbox Code Playgroud)
小智 26
避免必须选择库的潜在替代方案是使用对象即
Sub http()
Dim MyRequest As Object
Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
MyRequest.Open "GET", _
"http://www.google.com"
' Send Request.
MyRequest.Send
'And we get this response
MsgBox MyRequest.ResponseText
End Sub
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
49580 次 |
最近记录: |