
You can download
a file from the website!
VBA Code
You can download a file from the website by Windows API “URLDownloadToFile”.
Option Explicit
'Windows API
Private Declare PtrSafe 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
Sub sampleProc()
Dim url As String
Dim filePath As String
Dim result As Long
'Set "URL"
url = "https://github.com/git-for-windows/git/releases/download/v2.35.1.windows.2/Git-2.35.1.2-64-bit.exe"
'Set "file path to save"
filePath = "C:\Users\user\Desktop\Git-2.35.1.2-64-bit.exe"
'Run Download
result = URLDownloadToFile(0, url, filePath, 0, 0)
If result = 0 Then
MsgBox ("Succeeded")
Else
MsgBox ("failed ")
End If
End Sub
Result
You downloaded file from the website!


FYI
For more information about following, see the following official online manual:
●Windows API “URLDownloadToFile”