
Sub LeggiFilesExcel() Dim X As Long Dim File As String Cartella = "C:UsersxxxxDesktop" 'da cambiare gli xxxx File = Dir(Cartella & "*.x*") X = 1 Do While File <> "" Cells(X, 1) = File File = Dir X = X + 1 Loop End Sub |
Sub trova()
Dim myPath, MyFileFound
Dim FSO As Object
Dim F As Object
Dim Fi As Object
Dim v, num As Long
Dim MyFile
Application.DisplayAlerts = False
MyFile = ActiveWorkbook.FullName
num = 0
On Error Resume Next
Set FSO = CreateObject("Scripting.FileSystemObject")
Application.DisplayAlerts = False
myPath = "C:.............Desktop"
Set F = FSO.GetFolder(myPath)
For Each Fi In F.Files
If LCase(FSO.GetExtensionName(Fi.Path)) = "xls" Then
Range("a" & num + 1) = Fi
num = num + 1
End If
Next
End Sub |
If LCase(FSO.GetExtensionName(Fi.Path)) Like "xls*" Then
