wackywoo105
Registered User.
- Local time
- Yesterday, 22:37
- Joined
- Mar 14, 2014
- Messages
- 203
I was writing a procedure usingVBA in access to use internet explorer. I have come up against an issue with compatibility which I will not be able to circumvent, and why am I using a depreciated browser?
I had it largely working and am now trying to convert the code to work with an Edge browser form window. I have added an edge browser control to my form.
Can anyone help with how to alter the following to work with edge?
I added the extra bit with gettag as sometimes the page wasn't fully loaded before access tried to enter data. I largely seemed to work. Is there a better method with edge?
I had it largely working and am now trying to convert the code to work with an Edge browser form window. I have added an edge browser control to my form.
Code:
Me.EdgeBrowser0.Navigate "https://webpage"
Can anyone help with how to alter the following to work with edge?
Code:
IE.Document.getElementById("PlaceHolderMain_signInControl_UserName").Value = "login"
IE.Document.getElementById("PlaceHolderMain_signInControl_password").Value = "password"
IE.Document.getElementById("PlaceHolderMain_signInControl_login").Click
Code:
Select Case Title
Case "Prof"
IE.Document.getElementById("titleCode").selectedIndex = 1
Case "Sister"
IE.Document.getElementById("titleCode").selectedIndex = 2
Case "Mr"
IE.Document.getElementById("titleCode").selectedIndex = 3
Case "Mrs"
IE.Document.getElementById("titleCode").selectedIndex = 4
End Select
Code:
Do Until IE.ReadyState = 4 And Not IE.Busy
DoEvents
Loop
I added the extra bit with gettag as sometimes the page wasn't fully loaded before access tried to enter data. I largely seemed to work. Is there a better method with edge?
Code:
x = Timer + 3 'extra bit just to make sure it's fully loaded
Do While Timer < x
DoEvents
Loop
'Do While getTagNumber(IE, "title", "PCSE", 0) = -1
x = Timer + 1
Do While Timer < x
DoEvents
Loop
DoEvents
Loop
Code:
' Returns the number of the HTML element specified by tagname and identifying text
Function getTagNumber(IE As InternetExplorer, tagName As String, Optional identifyingText As String, Optional startAtTagNumber As Long = 0) As Long
Dim x As Long
Dim t As Object
For x = startAtTagNumber To IE.Document.all.Length - 1
Set t = IE.Document.all(x)
If UCase(t.tagName) = UCase(tagName) Then
'we found the right kind of tag, check to see if it has the right text
'Debug.Print t.outerHTML
If InStr(1, t.outerHTML, identifyingText) > 0 Then
'we found the right kind fo tag with the right identifying text, return the number
getTagNumber = x
Exit Function
End If
End If
Next
getTagNumber = -1 ' sentinal value indicating the tag was not found
End Function
Code:
Dim ClaimNumberTag As Long
ClaimNumberTag = getTagNumber(IE, "strong", "Claim Number", 0)
PCSEGOS1ClaimDate = Format(Now, "dd/mm/yyyy")
If PCSEGOS1ClaimNumber & "" Like "" Then
PCSEGOS1ClaimNumber = Replace(IE.Document.all(ClaimNumberTag).innerHTML, "Claim Number: ", "")
Else
PCSEGOS1ClaimNumber = Replace(IE.Document.all(ClaimNumberTag).innerHTML, "Claim Number: ", "") & ", " & PCSEGOS1ClaimNumber
End If
Last edited: