Grazie uguale Oregon, ho risolto....mando il codice per i posteri:
codice:
'dichiara una variabile per il corrente URL
Dim percorso As String
Dim mercati As String
Dim data_inizio As Date
Dim data_fine As Date
Dim data_corrente As Date
Dim nome_file As String
Dim strdt As String
Dim strUrl As String
Private Sub Command1_Click()
Dim Elementi As ListItem
Dim Intestazione As ColumnHeader
Dim strPercorsoLog As String
Dim blnElimina As Boolean
MousePointer = vbHourglass
DoEvents
Me.lstFileLOG.ColumnHeaders.Clear
Me.lstFileLOG.ListItems.Clear
blnElimina = False
Set Intestazione = Me.lstFileLOG.ColumnHeaders.Add(, , "XML non presenti", 20000)
DoEvents
mercati = Combo1
data_inizio = DTPicker1
data_fine = DTPicker2
data_corrente = data_inizio
While (data_corrente <= data_fine)
blnElimina = False
strdt = data_corrente
percorso = mercati + strdt
strUrl = "http://www.mercatoelettrico.org/GmewebItaliano/WebServerDataStore/" + gunnellabug(percorso) + ".xml"
Label1.Caption = strUrl
Open "d:\" + nome_file For Output As #1
Print #1, Inet1.OpenURL(strUrl) 'salva la stringa nel file
Close #1 'chiude il file
Open "d:\" + nome_file For Input As #1
While Not EOF(1)
Line Input #1, strPercorsoLog
If InStr(1, strPercorsoLog, "<h2>HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)</h2>") <> 0 Then
Set Elementi = lstFileLOG.ListItems.Add(, , nome_file)
blnElimina = True
End If
Wend
Close #1
DoEvents
If blnElimina = True Then
Kill "d:\" + nome_file
DoEvents
End If
data_corrente = data_corrente + 1
Wend
MsgBox "Download effettuato"
MousePointer = vbNormal
DoEvents
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub DTPicker1_Change()
DTPicker2.MinDate = DTPicker1.Value
End Sub
Private Sub Form_Load()
Combo1.AddItem "MGP_Prezzi"
Combo1.AddItem "MGP_Quantita"
Combo1.AddItem "MGP_Fabbisogno"
Combo1.AddItem "MA1_Prezzi"
Combo1.AddItem "MA1_Quantita"
Combo1.AddItem "MSD_ServiziDispacciamento"
Combo1.AddItem "MB_ServiziDispacciamento"
Me.DTPicker1 = Date
Me.DTPicker2 = Date
DTPicker1_Change
End Sub
'funzione che permette di salvare i file nel formato numerico
Public Function gunnellabug(formina As String) As String
'dichiarazione variabili
Dim val As String
Dim risultato_mercato As String
Dim posizione_mercato As String
Dim posizione_attributo As String
Dim risultato_attributo As String
Dim lungtot As String
Dim data_estratta As String
Dim strdata As String 'data finale composta dall'unione dei singoli pezzetti
'assoccio la stringa da valutare
val = formina
'conto i caratteri che compongono la mia stringa
posizione_mercato = InStr(val, "_") 'posizione mercati
If (posizione_mercato = 3) Then
risultato_mercato = Mid(val, 1, 2) ' MGP,MA1
posizione_attributo = InStr(val, "/") 'posizione attributo
risultato_attributo = Mid(val, 4, posizione_attributo - 6) 'Prezzi,quantità,fabbisogno
Else
risultato_mercato = Mid(val, 1, 3) ' MGP,MA1
posizione_attributo = InStr(val, "/") 'posizione attributo
risultato_attributo = Mid(val, 5, posizione_attributo - 7) 'Prezzi,quantità,fabbisogno
End If
lungtot = InStr(val, "2005")
data_estratta = Mid(val, lungtot + 4 - 10)
strdata = Mid(data_estratta, 7, 4) + Mid(data_estratta, 4, 2) + Mid(data_estratta, 1, 2)
nome_file = strdata + risultato_mercato + risultato_attributo + ".xml"
'compongo la stringa finale codificata numericamente
gunnellabug = risultato_mercato + "_" + risultato_attributo + "/" + strdata + risultato_mercato + risultato_attributo
End Function