11. maj 2009 - 21:00Der er
7 kommentarer og 1 løsning
Mappe oversigt.
Jeg sidder og roder lidt med en mappe oversigt, i excel. Er det muligt at lave en mappe oversigt fra "c:\my pictures\" i excel. Altså vise alle mapper der findes på drevet, i denne ene mappe ??
Derfra vil jeg så gerne have en oversigt over hverenkelt fil i mappen, men det kan jeg nok selv finde frem til.
Sub SrchForFiles() Dim i As Long, z As Long, Rw As Long Dim ws As Worksheet Dim y As Variant Dim fLdr As String, fil As String, FPath As String Dim MyTempList As Variant Dim lfldrnm As Integer Dim FldrName As String Dim FilName As String Dim sTmp As String Dim t As Long
y = "*.*" Application.ScreenUpdating = False '********************************************************************** With Application.FileDialog(msoFileDialogFolderPicker) .Show fLdr = .SelectedItems(1) End With '********************************************************************** With Application.FileSearch .NewSearch .LookIn = fLdr .SearchSubFolders = True .Filename = y
On Error GoTo 0 If .Execute() > 0 Then For i = 1 To .FoundFiles.Count fil = .FoundFiles(i) 'Get file path from file name MyTempList = Split(fil, "\") For t = 0 To UBound(MyTempList) Next t Filename = MyTempList(UBound(MyTempList)) Cells(i, 1).Select ActiveCell.Value = Filename
On Error GoTo 0 If .Execute() > 0 Then For i = 1 To .FoundFiles.Count fil = .FoundFiles(i) 'Get file path from file name MyTempList = Split(fil, "\") For t = 0 To UBound(MyTempList) Next t Filename = MyTempList(UBound(MyTempList)-1) Cells(i, 1).Select ActiveCell.Value = Filename Filename = MyTempList(UBound(MyTempList)) Cells(i,2).Select ActiveCell.value
hvis du ændre til dette vil du få mappe navn i kolummme A og filnavn i B
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.