Želel bi izpis datotek. Iz starejšega foruma sem našel ustrezno kodo. Koda dela, vendar bi želel, da mi izpiše le ime datoteke (lahko tudi s končnico) in ne celotno ime "Full Name".
Prilagam kodo, žal pa ne vem ukaza , da bi mi izpisal le ime. Prosim za malo pomoči.
Sub Isci_datoteke()
'
Dim i As Long
Dim ZacetnaCelica As Range
Set ZacetnaCelica = Worksheets("list1").Range("a1")
With Application.FileSearch
.NewSearch
.LookIn = "c:\Documents and Settings" ' bolj natančno definirajte, kje naj išče
.SearchSubFolders = True ' ali res želite da preišče vse podmape?
.Filename = "*.doc"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
ZacetnaCelica.Offset(i, 0).Value = .FoundFiles(i)
Next i
Else
MsgBox "Nisem našel ustreznih datotek."
End If
End With
End Sub
Function ExtractFileName(fPath As String) As String
Dim i As Long, lcut As Long, llen As Long
i = InStr(i + 1, fPath, "\")
Do While i > 0
lcut = i
i = InStr(i + 1, fPath, "\")
Loop
If lcut > 0 Then
llen = Len(fPath) - lcut
ExtractFileName = Mid(fPath, lcut + 1, llen)
Else
ExtractFileName = ""
End If
End Function