运行时错误91 - 未设置对象

时间:2015-04-28 08:53:46

标签: html vba parsing

当运行下面的代码时,我得到一个运行时错误91 - 没有设置对象或有块...但我迷失了如何解决它。它发生在:

.document.body.innerHTML = Status.innerHTML

任何人都能看透?

Dim Groups  As Collection
Set Groups = New Collection
Groups.Add "LineGroupSA"
Groups.Add "LineGroupPR"
Groups.Add "LineGroupEM"
i = 0
For Each group In Groups
Set Status = IEDoc.getElementById(group)
With Ie
    .document.body.innerHTML = Status.innerHTML
    .document.body.createTextRange.execCommand "Copy"
    ActiveSheet.Paste Destination:=Sheets("Sheet3").cells(1, i)
    .Quit
End With
i = i + 1
Next group

HTML:

<TR id=LineGroupSA class="ui-datatable-summaryrow ui-widget-header">
    <TD style="WIDTH: 5%"></TD> 
    <TD style="WIDTH: 10%">SA</TD> 
    <TD colSpan=6><SPAN style="COLOR: red; FONT-WEIGHT: bold">AWAITING CHANGES</SPAN></TD>
</TR>

1 个答案:

答案 0 :(得分:0)

变量Ie没有设置在任何地方......我猜这就是为什么提示错误“没有设置对象”