Report Running from IE to Edge Coding

trainer75

New Member
Joined
Jun 11, 2015
Messages
33
Hi all,

I use a report in excel that automatically updates every 15 minutes, but I have just come across an error with the coding since the introduction of the IE mode in Edge.

The debugger shows the error associated to the InternetExplorerMedium wording (see below in context of code)

Sub Update()
Rerun = 0
If testrun = 0 Then
Call Repeater
End If
Set IE = New InternetExplorerMedium
IE.Visible = False
If Hour(Now()) > 6 Then
IE.Navigate (ThisWorkbook.Sheets("Details").Cells(3, 1).Value)
Else
IE.Navigate (ThisWorkbook.Sheets("Details").Cells(5, 1).Value)
End If
Do
If IE.ReadyState = 4 Then

On Error GoTo jumpy:
IE.Document.Forms(0).all("usr_id").Value = ThisWorkbook.Sheets("Details").Cells(3, 8).Value
IE.Document.Forms(0).all("usr_pswd").Value = ThisWorkbook.Sheets("Details").Cells(5, 8).Value
Set objInputs = IE.Document.getElementsByTagName("input")
For Each ele In objInputs
If ele.ID Like "login_user" Then
ele.Click
End If
Next
Exit Do

Else
DoEvents
End If
Loop

jumpy:
IE.Navigate (ThisWorkbook.Sheets("Details").Cells(3, 1).Value)
Do
If IE.ReadyState = 4 Then
Application.ScreenUpdating = False
Set HTMLDoc = IE.Document
Set eleColtr = HTMLDoc.getElementsByTagName("tr")
ThisWorkbook.Sheets("Input").Range("A1:AC100").Clear
i = 0
For Each eleRow In eleColtr
Set eleColtd = HTMLDoc.getElementsByTagName("tr")(i).getElementsByTagName("td")
j = 0
For Each eleCol In eleColtd
If Len(eleCol.innerText) >= 1 Then
ThisWorkbook.Sheets("Input").Range("A1").Offset(i, j).Value = eleCol.innerText
End If
j = j + 1
Next eleCol
i = i + 1
Next eleRow
If ThisWorkbook.Sheets("Summary").Range("D4").Value > 0 Then
ThisWorkbook.Sheets("Update List").Activate
Sheets("Update List").Range("2:2").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
ThisWorkbook.Sheets("Details").Activate
ThisWorkbook.Sheets("Details").Range("E6").Value = Now()
ThisWorkbook.Sheets("Summary").Activate
ThisWorkbook.Sheets("Summary").Range("B4:G4").Copy
ThisWorkbook.Sheets("Update List").Activate
Sheets("Update List").Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("1600:1600").Select
Selection.Delete Shift:=xlUp
Else
If Rerun = 0 Then
Rerun = 1
GoTo jumpy:
End If
End If
ThisWorkbook.Sheets("Summary").Activate
ThisWorkbook.Sheets("Summary").Range("A1").Select
Exit Do
Else
DoEvents
End If
Loop
exitall:
IE.Quit
Application.ScreenUpdating = True
ThisWorkbook.Save
End Sub


Is there anything that can replace this part of the code to get the report running again.

Any help is appreciated.

Thank you
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
And which is the error?
Did you set a reference to the Microsoft Internet Controls (ieframe.dll) libary? From vbe, Menu /Tools /References; scroll the list and "check" that item, then Ok (stop any macro if "References" is grayed in the menu, and retry)
 
Upvote 0
Hi, thank you for replying.

The error is the InternetExplorerMedium text within the code. It is trying to open an internet explorer page but as its now Edge it just comes back as an error.

I checked that the Microsoft Internet Controls is switched on from the visual basics list
 
Upvote 0
The error is the InternetExplorerMedium text within the code. It is trying to open an internet explorer page but as its now Edge it just comes back as an error.
Which is the error message?
Anyway try replacing that instruction with:
VBA Code:
'Set IE = New InternetExplorerMedium
Set IE = CreateObject("InternetExplorer.Application")

I also should recommand using IE.Visible = True rather than False
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,143
Members
453,021
Latest member
Justyna P

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