4

Excel 2007 および VBA 6.5 を使用

データ収集タスクを自動化しようとしていますが、「実行時エラー 91 - 「オブジェクト変数またはブロック変数が設定されていません」が発生し続けます。これは参照の問題ですか、それとも私のスクリプトに関係していますか?

ありがとう。

スクリプトは以下に含まれています (パスワードと変数は保護されています)

Sub Basic_Web_Query()

Set ie = CreateObject("InternetExplorer.Application")
    With ie
        .Visible = True
        .Navigate "https://www.urbics.com/Login.php"
        Do Until .ReadyState = 4
            DoEvents
        Loop
        .document.all.Item("User Name").Value = "UserName"
        .document.all.Item("Password").Value = "Password"
        .document.forms(0).submit
    End With

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.urbics.com/Urbics.php?hs=a97cd706q9948q11e1qbbacq00259002436c&pgreq=AVTotals&aid=4517", Destination:=Range("$B$4"))

.Name = "q?s=goog_2"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "1,2"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False

End With
End Sub
4

1 に答える 1

4

これらの行を変更します

    .document.all.Item("User Name").Value = "UserName"
    .document.all.Item("Password").Value = "Password"

    .document.all.Item("loginUserName").Value = "UserName"
    .document.all.Item("loginUserPassword").Value = "Password"

そしてさらに試みる。

于 2012-05-08T21:37:09.633 に答える