'Download a file to a specific location using Edge
I have a function, which I am using in my VBA code, which will open Edge ,and open a file.
myUrl variable is the path to the file. Now when I the run the below code, the file will be downloaded to default download location. My question is anyway to alter this and mention the path, where the file needs to be saved? Lets say I need to store the file to "c/temp" , how I will pass this to the code?
Sub LOADEdge()
Set obj = CreateObject("Shell.Application")
obj.ShellExecute myUrl
End Sub
Solution 1:[1]
You could move the file after the download:
FileName = "YourFile.dat"
Source = Environ("UserProfile") & "\Downloads\" & FileName
Destination = "C:\Temp\" & FileName
FileCopy Source, Destination
If Dir(Destination, vbNormal) = FileName Then
' File copy successful.
Kill Source
End If
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gustav |
