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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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