我正在从网页复制HTML表格,以擅长。数据将粘贴到工作簿中添加的临时表中。在Excel上粘贴它时,它显示错误消息“此时无法进入中断模式”,这阻止我进一步移动。我在调试代码时收到此错误,但是当我正在播放时它,它直接显示错误代码91.我在网页中寻找一个单词,并尝试在Excel中复制该表,但它将整个页面复制到我的临时表上,并抛出该错误消息。请在下面找到我的代码:
sub sample()
Dim XMLHTTP As Object, html As Object
Dim Clipboard As Object
Dim Tabl_name As IHTMLElement
last_lin1st = Worksheets("sheet1").Columns(2).Find("Sum").Row
val_nci = Worksheets("sheet1").Range("B" & i).Value
With ThisWorkbook
.Sheets.Add(After:=.Sheets(.Sheets.Count)).Name = "temp"
End With
Set ie = Nothing
Set IeDoc = Nothing
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
strHTML = "webURL"
ie.navigate strHTML
Set IeDoc = ie.document
Set oXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
msg = ie.document.Body.innerhtml
For x = 0 To tables.Length
If tables(x).innerText Like "*End Analysis*" Then
Set Clipboard = New MSForms.DataObject
clipboard.SetText tables(x).outerHTML
Clipboard.PutInClipboard
Worksheets("temp").Cells(1, 1).PasteSpecial
End If
Next x
End Sub