Hi,I am using team developer 6.3. I have a request from my customer to download some pdf diplomas from TalentLMS. This site gives them an excel file with the link for each employees in order to download the diploma in a pdf file, But they do not have a choice to do a batch download, so they do have to click on each link and do a save as. for each employee. This takes too much time. They are asking if there is a way to do this in a program. I invistigated and found this function: URLDownloadToFile, that aparently can do that, but I do not have to much expirience using functions from windows.
Can anybody help me on how to use this function or if there is an alternative way thet I can "batch:"" download this files with the urls ?
Thank in advance
Use of URLDownloadToFile from TeamDeveloper 6.3
-
- Founder/Site Admin
- Posts: 3512
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
Re: Use of URLDownloadToFile from TeamDeveloper 6.3
Regards,
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
-
- Founder/Site Admin
- Posts: 3512
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
Re: Use of URLDownloadToFile from TeamDeveloper 6.3
Maybe a better way is to create a VBA macro which loads the Excel file containing the url's and download each defined URL file in a loop.
As an example:
As an example:
Code: Select all
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 OpenWorkbookLinks()
Dim wkb As Workbook
Dim sheet As Worksheet
Dim x As Integer
' Open the Excelfile having URLs
Set wkb = Workbooks.Open("C:\Temp\DownloadLinks.xlsx")
' Find the sheet containing the URLs. Here the sheet is named "SHEET_URLS"
Set sheet = wkb.Worksheets("SHEET_URLS")
Application.ScreenUpdating = False
NumRows = sheet.Range("A1", Range("A1").End(xlDown)).Rows.Count
sheet.Range("A1").Select
' Set the local download folder
savepath = "C:\temp\"
' Loop through all cells until empty
For x = 1 To NumRows
ActiveCell.Offset(1, 0).Select
URL = ActiveCell.Text
' Get the file part of the url (last part after the last forward slash)
file = Mid$(URL, InStrRev(URL, "/") + 1)
' Download the file
URLDownloadToFile 0, URL, savepath & file, 0, 0
Next
Application.ScreenUpdating = True
End Sub
Regards,
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Re: Use of URLDownloadToFile from TeamDeveloper 6.3
Thank You Dave for your Fast eresponse!! I will give both solutions a try!!!




Who is online
Users browsing this forum: [Ccbot] and 8 guests