Vincular varios archivos a la vez

Me gustaría saber si hay alguna manera de poder vincular varios archivos al mismo tiempo en lugar de ir uno por uno. En decir, yo quiero vincular todos los archivos que hay dentro de una carpeta a una hoja excel.

1 Respuesta

Respuesta
1

.

Sólo has descrito el 10% de tu necesidad...

Veamos:

a) ¿Qué cosa quieres vincular (qué libros, que hojas, que celdas)?...

b) ¿Hacia dónde quieres vincular (hacia que hoja, hacia que celda)?...

Como advertirás: ¡Te ha faltado "un mundo" de explicaciones!

.

Pues son carpetas que contienen archivos Excel y pdf. Y lo quiero vincular hacia una hoja Excel 

:)

Intenta con:

Sub Generar_Lista_de_Archivos()
Dim ws As Worksheet, iFile, mPath$
iFile = "Selecciona uno cualquiera de" & vbLf & "los archivos a listar:"
MsgBox iFile
iFile = Application.GetOpenFilename
If VarType(iFile) = vbBoolean Then Exit Sub
Application.ScreenUpdating = False
Set ws = ActiveSheet
mPath = Left(iFile, InStrRev(iFile, "\"))
iFile = Dir(mPath & "*.*")
ws.[a1].CurrentRegion.Delete xlUp: ws.[a1] = "Listado de archivos"
While iFile <> ""
  If iFile Like "*.*xl*" Or iFile Like "*.pdf" Then
    ws.Hyperlinks.Add _
      Anchor:=ws.Cells(Rows.Count, "a").End(xlUp).Offset(1), _
      Address:=mPath & iFile, _
      TextToDisplay:=iFile
  End If
  iFile = Dir
Wend
With ws.ListObjects.Add(xlSrcRange, ws.[a1].CurrentRegion, , xlYes)
  .Range.Columns.AutoFit
  .TableStyle = "TableStyleMedium17"
  .Unlist
End With
Application.ScreenUpdating = True
End Sub

¿Te sirve la idea?...

:)

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas