Hi there folks! I have a list of schoolwork that I would like the students to work on at home, the list of school work is in a listbox called DownloadList
I loaded the list list like this...
Public Sub LoadTheWorkList()
'This code will load the WorkToDo.txt to the listbox so the program can download all of the files needed for the day.
Dim ff As Long
Dim line As String
ff = FreeFile
Open App.Path & "\ResourceFiles\WorkActivities" & Desk.lblDate.Caption & "\WorkToDo.txt" For Input As #ff
Do While Not EOF(ff)
Line Input #ff, line
'make sure we're not adding a blank line
If Len(line) Then DownloadList.AddItem line
Loop
Close #ff
End Sub
What I would like to do is an item is loaded into the listbox, to download it from a website. Up until now, I have been using this code to download files one at a time, which does work.
VB Code:
Dim sSourceUrl As String Dim sLocalFile As String Dim hfile As Long sSourceUrl = "http://microhardxce.com/WeeklyNewsletters/WeeklyNewsletter-" & Desk.lblDate.Caption & ".pdf" sLocalFile = App.Path & "\ResourceFiles\WorkActivities\WeeklyNewsletters\WeeklyNewsletter-" & Desk.lblDate.Caption & ".pdf" Label1.Caption = sSourceUrl Label2.Caption = sLocalFile If DownloadFile(sSourceUrl, sLocalFile) Then hfile = FreeFile Open sLocalFile For Input As #hfile On Error Resume Next Text1.Text = Input$(LOF(hfile), hfile) If Err Then Else End If Close #hfile End If
Essentially what I'm trying to do is as each item is loaded into the listbox is downloaded. The listbox doesn't have many files, maybe 5 at the most.
Would anyone know how to do that?Thanks!



Reply With Quote