VBA Error when Connecting to IE

JJones23016

New Member
Joined
Apr 16, 2020
Messages
5
Office Version
  1. 365
  2. 2016
Platform
  1. 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
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top