› Sviluppare funzionalita su Microsoft Office con VBA › Scrivere una proc di collegamento ad una pagina Web senza usare InternetExplorer
-
AutoreArticoli
-
Ciao a tutti da Maurizio
Il mio Problema e questo: Visto che tra un po' di tempo non si potrà più usare (InternetExplorer) in quanto verrà sostituito da (Edge)
E visto che la maggior parte dei miei progetti estrapolano dati direttamente dalle pagine web sfruttando il vba.Mi stavo chiedendo come sia possibile aprire una pagina web , Estrarre dei dati , e fare in modo che si possa chiudere a sua volta ; Il tutto senza usare (InternetExplorer)
Ma solo Edge ho Google Tutto qui Grazie.(P.S) Io stupidamente avevo pensato di usare le Api di Windows per aprire la pagina web
Ma pur funzionando bene , mi sono accorto che non solo non riesco a chiudere la pagina web aperta.
Ma non riesco ad estrarre nessun dato .
Cosa che invece con "Explorer " avveniva egregiamente tutto qui .
Io ho usato questa procedura:Dim Y As String, X As String Dim open_Windows As Object Dim IE As Object Dim OggCol0 As Object, OggCol As Object, OggCol1 As Object, OggCol2 As Object, _ OggCol3 As Object, OggCol4 As Object, OggCol5 As Object, _ OggCol6 As Object, OggCol7 As Object, OggCol8 As Object, _ OggCol9 As Object, OggCol10 As Object, OggCol11 As Object, _ OggCol12 As Object, OggCol13 As Object, OggCol14 As Object, _ OggCol15 As Object, OggCol16 As Object, OggCol17 As Object, _ OggCol18 As Object, OggCol19 As Object, OggCol20 As Object, _ OggCol21 As Object, OggCol22 As Object, OggCol23 As Object, _ OggCol24 As Object, OggCol25 As Object Dim cell, Shp As Shape, Target As Range Dim rng As Object Dim filenam As Variant Dim myStart As Variant Dim I As Long Dim F As Long Dim k Dim Shell_Application As Object Dim cel As Variant, Text As Variant, Riga As Variant, UltimaRiga As Variant, Search As Variant, SearchRange As Variant, MyStr As Variant, MyStr2 As Variant, UpperCase As Variant, UpperCase2 As Variant Dim Domanda As String, Domanda2 As String Sub Previsioni_Meteo(ByVal myURL As String) On Error GoTo Finish X = Foglio1.Range("G1").Value & "" Y = Foglio1.Range("I1").Value & "" 'myURL = "https://www.worldweatheronline.com/" & X & "/" & Y & "" & "/it.aspx" '#pills-tomorrow" Set Shell_Application = CreateObject("Shell.application") For Each open_Windows In Shell_Applicatio.Windows If TypeName(open_Windows.document) = "htmldocument" Then Set IE = open_Windows Exit For End If Next If IE Is noting Then 'MsgBox "Ok" Else 'MsgBox "Non Trovato" IE.Navigate "https://www.worldweatheronline.com/" & X & "/" & Y & "" & "/it.aspx" '#pills-tomorrow" End If 'With IE '.Navigate "https://www.worldweatheronline.com/" & X & "/" & Y & "" & "/it.aspx" '#pills-tomorrow" '.Visible = True 'Do While .Busy: DoEvents: Loop 'Do While .ReadyState <> 4: DoEvents: Loop 'End With 'Do 'DoEvents 'If Timer > myStart + 2 Or Timer < myStart Then Exit Do 'Loop With IE.document Set OggCol = IE.document.getElementsByClassName("row") Set OggCol1 = IE.document.getElementsByClassName("col-lg-6 col-md-6 col-sm-12 col-12") Set OggCol2 = OggCol1(0).getElementsByTagName("img") End With For k = 0 To OggCol.Length With Sheets("Foglio1") .Range("A8").Offset(k, 1).Value = Replace(OggCol2(k).getAttribute("src"), "//", "https://", , , vbTextCompare) End With Next k 'Chiusura IE 'Shell_Application.Quit Set IE = Nothing Set Shell_Application = noting Finish: End SubAllego File di prova
Premetto che è un pochino incasinato ma questo e quanto GrazieAllegati:
You must be logged in to view attached files. -
AutoreArticoli
