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
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