Code: Select all
Option Explicit
Dim NOMEFILE As String, URLFILE As String
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Private Sub ESTRAI_DATA()
NOMEFILE = "comuni_geocoded.csv"
URLFILE = "https://github.com/gnekt/geolocalizzazione-comuni-italiani/blob/main/comuni_geocoded.csv"
DownloadFile URLFILE, "C:\Lavori_Vb6\COMUNI_GEOCODE\FILE\" & NOMEFILE
End Sub
Private Sub Command1_Click()
Call ESTRAI_DATA
End Sub