Note : I am using Excel 2013
[FONT="]Option Explicit[/FONT]
[FONT="]Type FoundFileInfo[/FONT]
[FONT="]sPath As String[/FONT]
[FONT="]sName As String[/FONT]
[FONT="]End Type[/FONT]
[FONT="]------------------------------------------------------------------------------------------------------------------------------[/FONT]
[FONT="]Function FindFiles(ByVal sPath As String, ByRef recFoundFiles() As FoundFileInfo, ByRef iFilesFound As Integer, _[/FONT]
[FONT="]Optional ByVal sFileSpec As String = "*.*", Optional ByVal blIncludeSubFolders As Boolean = False) As Boolean[/FONT]
[FONT="]End Function[/FONT]
[FONT="]-----------------------------------------------------------------------------------------------------------------------------[/FONT]
[FONT="]Public Sub Ara()[/FONT]
[FONT="]Dim iFilesNum As Integer[/FONT]
[FONT="]Dim iCount As Integer[/FONT]
[FONT="]Dim recMyFiles() As FoundFileInfo[/FONT]
[FONT="]Dim blFilesFound As Boolean[/FONT]
[FONT="]blFilesFound = FindFiles("C:\Users\XXXXX\Desktop\New Folder", recMyFiles, iFilesNum, "*.txt?", True)[/FONT]
[FONT="]If blFilesFound Then[/FONT]
[FONT="]For iCount = 1 To iFilesNum[/FONT]
[FONT="]With recMyFiles(iCount)[/FONT]
[FONT="]MsgBox "Path:" & vbTab & .sPath & vbNewLine & "Name:" & vbTab & .sName, vbInformation, "Found Files"[/FONT]
[FONT="]End With[/FONT]
[FONT="]Next[/FONT]
[FONT="]Else[/FONT]
[FONT="]MsgBox "No file(s) found matching the specified file spec.", vbInformation, "File(s) not Found"[/FONT]
[FONT="]End If[/FONT]
[FONT="]End Sub[/FONT]
[FONT="]Option Explicit[/FONT]
[FONT="]Type FoundFileInfo[/FONT]
[FONT="]sPath As String[/FONT]
[FONT="]sName As String[/FONT]
[FONT="]End Type[/FONT]
[FONT="]------------------------------------------------------------------------------------------------------------------------------[/FONT]
[FONT="]Function FindFiles(ByVal sPath As String, ByRef recFoundFiles() As FoundFileInfo, ByRef iFilesFound As Integer, _[/FONT]
[FONT="]Optional ByVal sFileSpec As String = "*.*", Optional ByVal blIncludeSubFolders As Boolean = False) As Boolean[/FONT]
[FONT="]End Function[/FONT]
[FONT="]-----------------------------------------------------------------------------------------------------------------------------[/FONT]
[FONT="]Public Sub Ara()[/FONT]
[FONT="]Dim iFilesNum As Integer[/FONT]
[FONT="]Dim iCount As Integer[/FONT]
[FONT="]Dim recMyFiles() As FoundFileInfo[/FONT]
[FONT="]Dim blFilesFound As Boolean[/FONT]
[FONT="]blFilesFound = FindFiles("C:\Users\XXXXX\Desktop\New Folder", recMyFiles, iFilesNum, "*.txt?", True)[/FONT]
[FONT="]If blFilesFound Then[/FONT]
[FONT="]For iCount = 1 To iFilesNum[/FONT]
[FONT="]With recMyFiles(iCount)[/FONT]
[FONT="]MsgBox "Path:" & vbTab & .sPath & vbNewLine & "Name:" & vbTab & .sName, vbInformation, "Found Files"[/FONT]
[FONT="]End With[/FONT]
[FONT="]Next[/FONT]
[FONT="]Else[/FONT]
[FONT="]MsgBox "No file(s) found matching the specified file spec.", vbInformation, "File(s) not Found"[/FONT]
[FONT="]End If[/FONT]
[FONT="]End Sub[/FONT]