Aşağıdaki basit bir kodu çalıştıramadım. Amacım belirli bir folder' daki dosyaların listesini çıkarmaktır. Anlayan varsa yardımcı olabilir misiniz ?
Not : Excel 2013' de çalışıyorum.
Option Explicit
Type FoundFileInfo
sPath As String
sName As String
End Type
------------------------------------------------------------------------------------------------------------------------------
Function FindFiles(ByVal sPath As String, ByRef recFoundFiles() As FoundFileInfo, ByRef iFilesFound As Integer, _
Optional ByVal sFileSpec As String = "*.*", Optional ByVal blIncludeSubFolders As Boolean = False) As Boolean
End Function
-----------------------------------------------------------------------------------------------------------------------------
Public Sub Ara()
Dim iFilesNum As Integer
Dim iCount As Integer
Dim recMyFiles() As FoundFileInfo
Dim blFilesFound As Boolean
blFilesFound = FindFiles("C:\Users\XXXXX\Desktop\New Folder\", recMyFiles, iFilesNum, "*.txt?", True)
If blFilesFound Then
For iCount = 1 To iFilesNum
With recMyFiles(iCount)
MsgBox "Path:" & vbTab & .sPath & vbNewLine & "Name:" & vbTab & .sName, vbInformation, "Found Files"
End With
Next
Else
MsgBox "No file(s) found matching the specified file spec.", vbInformation, "File(s) not Found"
End If
End Sub
Not : Excel 2013' de çalışıyorum.
Option Explicit
Type FoundFileInfo
sPath As String
sName As String
End Type
------------------------------------------------------------------------------------------------------------------------------
Function FindFiles(ByVal sPath As String, ByRef recFoundFiles() As FoundFileInfo, ByRef iFilesFound As Integer, _
Optional ByVal sFileSpec As String = "*.*", Optional ByVal blIncludeSubFolders As Boolean = False) As Boolean
End Function
-----------------------------------------------------------------------------------------------------------------------------
Public Sub Ara()
Dim iFilesNum As Integer
Dim iCount As Integer
Dim recMyFiles() As FoundFileInfo
Dim blFilesFound As Boolean
blFilesFound = FindFiles("C:\Users\XXXXX\Desktop\New Folder\", recMyFiles, iFilesNum, "*.txt?", True)
If blFilesFound Then
For iCount = 1 To iFilesNum
With recMyFiles(iCount)
MsgBox "Path:" & vbTab & .sPath & vbNewLine & "Name:" & vbTab & .sName, vbInformation, "Found Files"
End With
Next
Else
MsgBox "No file(s) found matching the specified file spec.", vbInformation, "File(s) not Found"
End If
End Sub