Sub Download_File()
Windows("Example.xlsm").Activate ' activate your specific macro file
Cells.ClearContents
Dim file As String
Dim path As String
path = "Path where you want to save the file" ' Example:- C:\Test\
file = "Path of the file that you want to download" ' Example : - www.example.com/one.csv
ThisWorkbook.FollowHyperlink file ' parsing file URL
With ActiveWorkbook
.SaveAs path & "new.csv" ' altering file name and type to the location
.Save
.ActiveSheet.Range("A:C").Copy ' Copying the data of column A - C from the downloaded file
Application.DisplayAlerts = False ' Alerts disabled to ensure file is closed without any prompt message
.Close
Application.DisplayAlerts = True
End With
Windows("Example.xlsm"). ' re activate your specific macro file
ActiveSheet.Range("a1").Select ' select and paste the copied data
Range("a1").PasteSpecial xlPasteAll
Range("a1").Select
End Sub
Windows("Example.xlsm").Activate ' activate your specific macro file
Cells.ClearContents
Dim file As String
Dim path As String
path = "Path where you want to save the file" ' Example:- C:\Test\
file = "Path of the file that you want to download" ' Example : - www.example.com/one.csv
ThisWorkbook.FollowHyperlink file ' parsing file URL
With ActiveWorkbook
.SaveAs path & "new.csv" ' altering file name and type to the location
.Save
.ActiveSheet.Range("A:C").Copy ' Copying the data of column A - C from the downloaded file
Application.DisplayAlerts = False ' Alerts disabled to ensure file is closed without any prompt message
.Close
Application.DisplayAlerts = True
End With
Windows("Example.xlsm"). ' re activate your specific macro file
ActiveSheet.Range("a1").Select ' select and paste the copied data
Range("a1").PasteSpecial xlPasteAll
Range("a1").Select
End Sub
No comments:
Post a Comment