错误 800A01A8 需要对象 [英] Error 800A01A8 Object required

查看:24
本文介绍了错误 800A01A8 需要对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 VBScript 代码,它给了我一个错误,上面写着需要对象"在第 11 行和第 3 个字符处出现错误 800A01A8.

I have a VBScript code that gives me an error that says "Object required" and error 800A01A8 at row 11 and character 3.

代码如下:

Dim strWebsite

strWebsite = "78.72.111.138:80"

If PingSite( strWebsite ) Then
    Dim xHttp: Set xHttp = CreateObject("Microsoft.XMLHTTP")
    Dim bStrm: Set endbStrm = CreateObject("Adodb.Stream")
    xHttp.Open "GET", "http://?/batch/down.php", False
    xHttp.Send
    With bStrm
        .Type = 1 '//binary
        .Open
        .Write xHttp.responseBody
        .SaveToFile "link.txt", 2 '//overwrite
    End With
Else
End If

Function PingSite( myWebsite )
    Dim intStatus, objHTTP

    Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )

    objHTTP.Open "GET", "http://" & myWebsite & "/", False
    objHTTP.SetRequestHeader "User-Agent", _
        "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"

    On Error Resume Next

    objHTTP.Send
    intStatus = objHTTP.Status

    On Error Goto 0

    If intStatus = 200 Then
        PingSite = True
    Else
        PingSite = False
    End If

    Set objHTTP = Nothing
End Function

错误是.

推荐答案

You Dim bStrm,但初始化endbStrm:

You Dim bStrm, but initialize endbStrm:

dim bStrm: Set endbStrm = createobject("Adodb.Stream")

证据:

>> Dim x
>> With x
>>   .Type = 1
>> End With
>>
Error Number:       424
Error Description:  Object required
>>

使用 Option Explicit 避免此类错误.

Use Option Explicit to avoid such blunders.

这篇关于错误 800A01A8 需要对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆