ciao a tutti non riesco a fare andare il seguente codice(per provarlo bisogna scollegarsi da internet) la prima volta quando arriva a
.Refresh BackgroundQuery:=False
e trova l'errore va si ad etichetta e poi da qui rientra correttamente in etichetta1 però qui appena legge
.Refresh BackgroundQuery:=False
mi da errore cosa che non dovrebbe accadere per 60 volte come da codice ho provato anche a mettere
On Error GoTo Etichetta
sotto ad etichetta1 ma non và .
grazie per l'attenzione
in pratica la macro dovrebbe provare a a fare 60 tentativi di refresh prima di rinunciare
codice:Sub IN_LAVORAZIONE() Application. ScreenUpdating = False Dim cont As Byte On Error Goto Etichetta With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.borsaitaliana.it/bitApp/l...=11&sub_list=2" _ , Destination:=ActiveCell) . Name = "listino?service=Data&lang=it&main_list=11&sub_list=2" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlSpecifiedTables .WebFormatting = xlWebFormattingNone .WebTables = "6,7,8" .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False Etichetta1: .Refresh BackgroundQuery:=False End With MsgBox "macro ok" Exit Sub Etichetta: CreateObject("WScript.Shell").Popup "nuovo tentativo: " & cont & " di 60 tra 5 secondi", 1, "errore nello scaricare i dati" Sleep 5000 cont = cont + 1 If cont = 60 Then MsgBox "PROBLEMA SULLA RETE INTERNET impossibile scaricare i dati" End If Goto Etichetta1 End Sub

Rispondi quotando