Private Sub UserForm_Initialize()
yol = "C:\Users\YILDIZ\Desktop\ULUSLARARASI İLİŞKİLER"
'yol = ThisWorkbook.Path & "\"
ListBox1.Clear
ListBox1.ColumnCount = 2
ListBox1.ColumnWidths = "0;100;0" 'lisbox'taki sütunların genişliği
Liste (yol)
End Sub
Private Sub Liste(yol As String)
Dim fL As Object, fs As Object, f As Object
Set fL = CreateObject("Scripting.FileSystemObject")
For Each Dosya In fL.getfolder(yol).Files
If ThisWorkbook.Name <> Dosya.Name Then
If Mid(Dosya.Name, 1, 2) <> "~$" Then
ListBox1.AddItem
sat1 = ListBox1.ListCount - 1
ListBox1.List(sat1, 0) = Dosya
ListBox1.List(sat1, 1) = Dosya.Name
End If
End If
Next
On Error GoTo sonraki
For Each f In fL.getfolder(yol).subfolders
Liste (f.Path)
sonraki:
Next
Set fL = Nothing
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dosya1 = ListBox1.List(ListBox1.ListIndex, 0)
If Dosya1 <> "" Then
CreateObject("Shell.Application").Open (Dosya1)
End If
End Sub
Private Sub TextBox1_Change()
yol = "C:\Users\YILDIZ\Desktop\ULUSLARARASI İLİŞKİLER"
'yol = ThisWorkbook.Path & "\"
ListBox1.Clear
ListBox1.ColumnCount = 2
ListBox1.ColumnWidths = "0;100;0" 'lisbox'taki sütunların genişliği
Liste2 (yol)
End Sub
Private Sub Liste2(yol As String)
Dim fL As Object, fs As Object, f As Object
Set fL = CreateObject("Scripting.FileSystemObject")
For Each Dosya In fL.getfolder(yol).Files
If ThisWorkbook.Name <> Dosya.Name Then
If Mid(Dosya.Name, 1, 2) <> "~$" Then
If UCase(Dosya.Name) Like "*" & UCase(Replace(Replace(TextBox1, "i", "İ"), "ı", "I")) & "*" Then
ListBox1.AddItem
sat1 = ListBox1.ListCount - 1
ListBox1.List(sat1, 0) = Dosya
ListBox1.List(sat1, 1) = Dosya.Name
End If
End If
End If
Next
On Error GoTo sonraki
For Each f In fL.getfolder(yol).subfolders
Liste2 (f.Path)
sonraki:
Next
Set fL = Nothing
End Sub