Private Function AllFiles(ByVal FullPath As String) _
As String()
Dim oFs As New FileSystemObject
Dim sAns() As String
Dim oFolder As Folder
Dim oFile As File
Dim lElement As Long
ReDim sAns(0) As String
If oFs.FolderExists(FullPath) Then
Set oFolder = oFs.GetFolder(FullPath)
For Each oFile In oFolder.Files
lElement = IIf(sAns(0) = "", 0, lElement + 1)
ReDim Preserve sAns(lElement) As String
sAns(lElement) = oFile.Name
Next
End If
AllFiles = sAns
ErrHandler:
Set oFs = Nothing
Set oFolder = Nothing
Set oFile = Nothing
End Function
işine yarayabilir mantığı kurabilirsin