fonction getobject pour internet explorer (les page non ouvertes par vba
par
, 16/09/2018 à 14h50 (534 Affichages)
[CODE]Sub test()
Dim objIE As Object
url = "https://www.google.fr/?gws_rd=ssl"
Set objIE = getobject_IE_BY_URL(url)
If Not objIE Is Nothing Then
MsgBox objIE.document.body.innertext
'ici exploitation de objIE.document......
Else
MsgBox "cette page web n'est pas ouverte"
End If
End Sub
Function getobject_IE_BY_URL(url) As Object
Dim Wind As Object
With CreateObject("Shell.Application")
For Each Wind In .Windows
'Debug.Print TypeName(Wind.document)
If TypeName(Wind.document) = "HTMLDocument" And Wind.LocationURL = url Then Set getobject_IE_BY_URL = Wind
Next
End With
End Function[/CODE]