use edge instead ie for VBA

gss.italy sal21 81 Reputation points
2022-12-06T06:02:53.603+00:00

i use this code with internet explorer object, possible to use edge browser instead?

Option Explicit
Sub PROVA()

Dim IE As Object, T As Integer, Title As Object  
Dim oHtml As HTMLDocument, post As Object  
  
Clear_Cache  
  
Set IE = CreateObject("internetexplorer.application")  
  
'CreateObject("Shell.Application").ShellExecute "microsoft-edge:https://demo.istat.it/app/?i=POS&l=it"  
  
With IE  
      
    .Visible = True  
    .navigate "https://demo.istat.it/app/?i=POS&l=it"  
      
    Do While .Busy  
        DoEvents  
    Loop  
      
    Do While .readyState <> 4  
        DoEvents  
    Loop  
      
    'CLICK SU VISTRA TERRITORIALE  
    .document.getElementById("tab-1").Click  
      
    'CHEKBOX TUTTI I COMUNI  
    .document.all("territorio")(3).Checked = True  
      
    'SELEZIONO UN ITEM PROVINCIA NEL COMBOBOX  
    Set Title = .document.getElementById("province-1")  
      
    'CONTO E PRENDO IL NOME DELLE PROVINCE NEL COMBOBOX  
    Set oHtml = .document  
    For Each post In oHtml.getElementById("province-1").getElementsByTagName("OPTION")  
        'Debug.Print T & "-" & post.innerText  
        T = T + 1  
    Next  
      
    Title.selectedIndex = 105  
      
    'CLICK CERCA  
    .document.getElementById("btnricerca-1").Click  
      
End With  
  
IE.Quit  
Set IE = Nothing  
  

End Sub

Developer technologies Visual Basic for Applications
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.