mySourcePath es la ruta princpical de la 1 lista
Sub ListMyFiles(mySourcePath)
' List the files and directories within "C:\".
mySourcePath = mySourcePath & "\"
Dim fList As String
Dim fLists As String
Dim fName As String
Dim fNames As String
Dim numero As String
numero = 0
iRow = 2
For inicios = 0 To Total
fName = Dir(mySourcePath, vbDirectory)
' The variable fName now contains the name of the first file or directory within "C:\".
If InStr(fNames, ".") > 0 Then
numero = Left(fNames, InStr(fNames, ".") - 1)
ElseIf InStr(fNames, "..") > 0 Then
numero = Left(fNames, InStr(fNames, "..") - 1)
End If
If numero = "" Then
inicios = 0
End If
Do While fName <> ""
' Store the current file or directory name in the string fList.
fList = fList & vbNewLine & fName
datos = Range("A" & iRow).Value
aux = 0
MsgBox "Ruta 1.1: " & fList
MsgBox "Datos: " & datos
If datos <> fName Then
fName = Dir()
ElseIf datos = fName Then
'la otra ruta modifica para que lista otras carpetas
rutas = mySourcePath & fName & "\ASUNTOS\"
fNames = Dir(rutas, vbDirectory)
Do While fNames <> ""
'fLists = fLists & vbNewLine & fNames
' Get the next file or directory within "C:\".
If InStr(fNames, ".") > 0 Then
numero = Left(fNames, InStr(fNames, ".") - 1)
ElseIf InStr(fNames, "-") > 0 Then
numero = Left(fNames, InStr(fNames, "-") - 1)
ElseIf InStr(fNames, "_") > 0 Then
numero = Left(fNames, InStr(fNames, "_") - 1)
End If
If numero = "" Then
fNames = Dir()
End If
If numero <> "" Then
iRows = 2
For inicio = 0 To Total
dato = Range("B" & iRows).Value
If dato = numero Then
Range("F" & iRows).Value = numero
ruta = fNames + numero
ActiveSheet.Hyperlinks.Add Anchor:=Cells(iRows, "E"), Address:=ruta, TextToDisplay:=numero
End If
If dato <> numero Then
End If
If dato = "" Then
End If
iRows = iRows + 1
Next inicio
fNames = Dir()
End If
Loop
iRow = iRow + 1
End If
Loop
fName = fName
fName = Dir()
iRow = iRow + 1
Next inicios
End Sub