Yes, it is possible to download video files from URLs and save them to specific folders with dynamically generated names. Here's an example of how you can achieve this using VBA in Excel:
VBA Code:
Sub DownloadAndSaveVideo()
Dim url As String
Dim folderName As String
Dim folderPath As String
Dim videoPath As String
' URL of the video
url = "https://dna1.braintreeeasysoft.com/533286666/533286666.html"
' Extract the folder name from the URL
folderName = Split(Split(url, "/")(3), ".")(0)
' Set the folder path where the video will be saved
folderPath = "C:\Path\To\Your\Folder\" & folderName
' Create the folder if it doesn't exist
If Dir(folderPath, vbDirectory) = "" Then
MkDir folderPath
End If
' Set the video file path
videoPath = folderPath & "\" & folderName & ".mp4"
' Download the video
URLDownloadToFile 0, url, videoPath, 0, 0
' Display a message with the saved video path
MsgBox "Video downloaded and saved to: " & videoPath
End Sub
In the above code, you need to replace "
https://dna1.braintreeeasysoft.com/533286666/533286666.html" with the actual URL of the video you want to download. The code extracts the folder name from the URL and creates a folder with that name in the specified folder path. Then, it constructs the video file path using the folder name and saves the video using the URLDownloadToFile function. Finally, a message box displays the path where the video has been saved.
Make sure to modify the folderPath variable to the desired location where you want the folders to be created and videos to be saved.
Note that the URLDownloadToFile function requires the urlmon library to be referenced in your VBA project. You can add the reference by going to the Visual Basic Editor (Alt+F11), selecting "Tools" from the menu, choosing "References," and then checking the box for "Microsoft URL Moniker Control" in the list.
Remember to customize the code according to your specific requirements and incorporate it into your existing VBA macro as needed.