RE:renombrar un fichero
Publicado por
Legin (1 intervención) el 30/05/2007 16:48:47
Hola he tratado desde hace un buen tiempo, renombrar un archivo en la misma ubicacion pero al darle name nombre as nuevonombre me tira un error en tiempo de ejecucion: Error '5' en tiempo de ejecucion: Lamada a procedimiento o argumento no valido
La verdad ya no se que hacer porque la instruccion esta bien, aqui les dejo para que me ayuden por favor!!!!
Dim var As Integer
Dim nomact As String
Dim nomfut As String
Dim I As Integer
Dim fecha As String
Dim hora As String
d.Drive = "c:\"
Dir.Path = d.Drive & "\PRUEBA"
f.Pattern = "*.TXT"
f.Path = d.Drive & "\PRUEBA"
var = f.ListCount - 1
For I = 0 To var
nomact = f.Path & "\" & f.List(I)
fecha = Year(FileDateTime(f.Path & "\" & f.List(I))) & "-" & Month(FileDateTime(f.Path & "\" & f.List(I))) & "-" & Day(FileDateTime(f.Path & "\" & f.List(I)))
hora = Hour(FileDateTime(f.Path & "\" & f.List(I))) & ":" & Minute(FileDateTime(f.Path & "\" & f.List(I))) & ":" & Second(FileDateTime(f.Path & "\" & f.List(I)))
'On Error Resume Next
nomfut = Mid(f.List(I), 1, Len(f.List(I)) - 4)
nomfut = f.Path & "\" & nomfut & "_" & fecha & "_" & hora & ".txt"
Name nomact As nomfut 'ES AQUI DONDE ME TIRA EL ERROR!!!!
Next I