Loop for downloading files with url of websites

Hello to All,
I have an already working code to open files in my own pc.
When I modify this code to download a list of files from web, it gives me various errors.
There are urls on column A. And new names I give them are on column B.
I want to save and rename bunch of csv files with one click, The same code could open files from a directory.
I have modified it to open urls. But I could not manage it work. It might seem a bit confusing but I left it intentionally this way so may be some might see the point I make mistake(s)

Thanks in advance to whomever honours my question with their replies.

REM  *****  BASIC  *****

Global oDocument as Object
Global Fname as string
Global fnURL as string

Sub OpenData
dim i as integer
Dim oSheet as object
Dim oCell1 as object



oDocument = ThisComponent
oSheet = oDocument.getCurrentController.getActiveSheet



i = 0
oCell1 = oSheet.getCellByPosition(i,0)

while oCell1.Type <> com.sun.star.table.CellContentType.EMPTY
i = i+1
oCell1 =  oSheet.getCellByPosition(i,0)




'Create new document and import data
oDocument = StarDesktop.LoadComponentFromURL( fnURL, "_blank", 0, _
Array(MakePropertyValue( "FilterName", "Text - txt - csv (StarCalc)" ), _
MakePropertyValue( "FilterOptions", "44,34,0,1,1" )
wend
fnURL=oCell1.string

End Sub

'property function 

Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue                 
oPropertyValue = createUnoStruct( "com.sun.star.beans.PropertyValue" ) 
If Not IsMissing( cName ) Then 
  oPropertyValue.Name = cName 
EndIf 
If Not IsMissing( uValue ) Then 
  oPropertyValue.Value = uValue 
EndIf 
MakePropertyValue() = oPropertyValue 
End Function