Might also be able to work it into a UDF
So, if your path was in A1, you could put the formula =Splitfiles(A1) which would give you the number and the list of files, at least in O365.
Function SplitFiles(Filepath As String)
Dim fso As Object, objFile As Object
Dim aFiles As Variant
ReDim aFiles(0)
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(Filepath)
aFiles(0) = oFolder.Files.Count
For Each objFile In oFolder.Files
ReDim Preserve aFiles(UBound(aFiles) + 1)
aFiles(UBound(aFiles)) = objFile.Name
Next
SplitFiles = Application.Transpose(aFiles)
End Function
Bookmarks