JJones23016
New Member
- Joined
- Apr 16, 2020
- Messages
- 5
- Office Version
- 365
- 2016
- Platform
- Windows
Hello,
I am getting an error message "Run-time Error '-2147023179 (800706b5)': Automations Error The interface is unknown", when running the below Macro. The Macro was working then stopped working. Any solutions?
Extract_Data Macro
'
Dim ie As Object
Dim doc As MSHTML.HTMLDocument
Dim tables As MSHTML.IHTMLElementCollection
Dim table As MSHTML.HTMLTable
Dim clipboard As MSForms.DataObject
Set ie = New InternetExplorer
'Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.navigate (ThisWorkbook.Sheets("Reference Page").Range("B1").Value)
While ie.READYSTATE <> 4 - This is where the error occurs
DoEvents
Wend
Set doc = .document
Set tables = doc.getElementsByTagName("table")
Set table = tables(0)
Set clipboard = New MSForms.DataObject
clipboard.SetText table.outerHTML
clipboard.PutInClipboard
ThisWorkbook.Sheets("Confirmed Cases Global").Paste
.Quit
End With
Set ie = Nothing
Set ie = New InternetExplorer
With ie
.Visible = True
.navigate (ThisWorkbook.Sheets("Reference Page").Range("B2").Value)
While ie.READYSTATE <> 4
DoEvents
Wend
Set doc = .document
Set tables = doc.getElementsByTagName("table")
Set table = tables(0)
Set clipboard = New MSForms.DataObject
clipboard.SetText table.outerHTML
clipboard.PutInClipboard
ThisWorkbook.Sheets("Confirmed Death Cases Global").Paste
.Quit
End With
Set ie = Nothing
Set ie = New InternetExplorer
With ie
.Visible = True
.navigate (ThisWorkbook.Sheets("Reference Page").Range("B3").Value)
While ie.READYSTATE <> 4
DoEvents
Wend
Set doc = .document
Set tables = doc.getElementsByTagName("table")
Set table = tables(0)
Set clipboard = New MSForms.DataObject
clipboard.SetText table.outerHTML
clipboard.PutInClipboard
ThisWorkbook.Sheets("Recovered Cases Global").Paste
.Quit
End With
Set ie = Nothing
Set ie = New InternetExplorer
With ie
.Visible = True
.navigate (ThisWorkbook.Sheets("Reference Page").Range("B4").Value)
While ie.READYSTATE <> 4
DoEvents
Wend
Set doc = .document
Set tables = doc.getElementsByTagName("table")
Set table = tables(0)
Set clipboard = New MSForms.DataObject
clipboard.SetText table.outerHTML
clipboard.PutInClipboard
ThisWorkbook.Sheets("US State Data").Paste
.Quit
End With
Set ie = Nothing
End Sub
I am getting an error message "Run-time Error '-2147023179 (800706b5)': Automations Error The interface is unknown", when running the below Macro. The Macro was working then stopped working. Any solutions?
Extract_Data Macro
'
Dim ie As Object
Dim doc As MSHTML.HTMLDocument
Dim tables As MSHTML.IHTMLElementCollection
Dim table As MSHTML.HTMLTable
Dim clipboard As MSForms.DataObject
Set ie = New InternetExplorer
'Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.navigate (ThisWorkbook.Sheets("Reference Page").Range("B1").Value)
While ie.READYSTATE <> 4 - This is where the error occurs
DoEvents
Wend
Set doc = .document
Set tables = doc.getElementsByTagName("table")
Set table = tables(0)
Set clipboard = New MSForms.DataObject
clipboard.SetText table.outerHTML
clipboard.PutInClipboard
ThisWorkbook.Sheets("Confirmed Cases Global").Paste
.Quit
End With
Set ie = Nothing
Set ie = New InternetExplorer
With ie
.Visible = True
.navigate (ThisWorkbook.Sheets("Reference Page").Range("B2").Value)
While ie.READYSTATE <> 4
DoEvents
Wend
Set doc = .document
Set tables = doc.getElementsByTagName("table")
Set table = tables(0)
Set clipboard = New MSForms.DataObject
clipboard.SetText table.outerHTML
clipboard.PutInClipboard
ThisWorkbook.Sheets("Confirmed Death Cases Global").Paste
.Quit
End With
Set ie = Nothing
Set ie = New InternetExplorer
With ie
.Visible = True
.navigate (ThisWorkbook.Sheets("Reference Page").Range("B3").Value)
While ie.READYSTATE <> 4
DoEvents
Wend
Set doc = .document
Set tables = doc.getElementsByTagName("table")
Set table = tables(0)
Set clipboard = New MSForms.DataObject
clipboard.SetText table.outerHTML
clipboard.PutInClipboard
ThisWorkbook.Sheets("Recovered Cases Global").Paste
.Quit
End With
Set ie = Nothing
Set ie = New InternetExplorer
With ie
.Visible = True
.navigate (ThisWorkbook.Sheets("Reference Page").Range("B4").Value)
While ie.READYSTATE <> 4
DoEvents
Wend
Set doc = .document
Set tables = doc.getElementsByTagName("table")
Set table = tables(0)
Set clipboard = New MSForms.DataObject
clipboard.SetText table.outerHTML
clipboard.PutInClipboard
ThisWorkbook.Sheets("US State Data").Paste
.Quit
End With
Set ie = Nothing
End Sub