I have this code that reads routes from a txt, and I need to copy the files with extension (jpg, pdf, html).
At the moment of executing I get the error of access denied . I already changed the permissions of the folders and it keeps throwing me the same error
This is the code:
Set myFSO = CreateObject("Scripting.FileSystemObject")
filelocation = "U:\Users\alpnheg\Documents\vbcopia\rutas.txt" 'locación del txt
If myFSO.FileExists(filelocation) Then 'mira si existe el archivo
Set logfile = myFSO.OpenTextFile(filelocation, 1) 'lee las rutas
Do While Not logfile.AtEndOfStream 'inicia loop
strcontents = ""
strcontents = logfile.ReadLine
If Not strcontents = "" then
'ARREGLAR ESTA FUNCIÓN
Set fso = CreateObject("Scripting.FileSystemObject")
Set FSO = CreateObject("scripting.FileSystemObject")
fso.copyfile (filelocation),"U:\Users\alpnheg\Documents\AAAAA",true
End if
Loop
logfile.Close 'closes the file