Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
I need to find all files in some directories and all thtis files start with
the same string. Regards Lopar |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
What do you want to do with the files once found? Open them, list their
names on a sheet, .... Regards Rowan Ivica Lopar wrote: I need to find all files in some directories and all thtis files start with the same string. Regards Lopar |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
I wont to put string in textbox1 and then clik commandbutton and have all path of files in listbox1 lop *** Sent via Developersdex http://www.developersdex.com *** |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
I'm guessing here but if you want to enter the path in TextBox1 and have
all excel files in that folder listed in listbox1 then you would do it like this: Private Sub CommandButton1_Click() Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Set objFSO = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set objFolder = objFSO.GetFolder(Me.TextBox1.Text) On Error GoTo 0 If Not objFolder Is Nothing Then For Each objFile In objFolder.Files If objFile.Type = "Microsoft Excel Worksheet" Then Me.ListBox1.AddItem objFile.Name End If Next End If End Sub Hope this helps Rowan ivica lopar wrote: I wont to put string in textbox1 and then clik commandbutton and have all path of files in listbox1 lop *** Sent via Developersdex http://www.developersdex.com *** |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
This is what I wont but this files are pictures not excel files
Regards lop *** Sent via Developersdex http://www.developersdex.com *** |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
Private Sub CommandButton7_Click()
Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Set objFSO = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set objFolder = objFSO.GetFolder(Me.TextBox4.Text) On Error GoTo 0 If Not objFolder Is Nothing Then For Each objFile In objFolder.Files If objFile.Type = "JPEG Image" Then Me.list1.AddItem objFile.Name End If Next End If This is what I tryed but it did not work out lop *** Sent via Developersdex http://www.developersdex.com *** |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
I heve folder named "Pictures" in that folder I have pictures that there
names start with some string for example "1201052" now when i put this string in TextBox1 I wont all path of pictures that start with that string to put in listBox1 Regards lop *** Sent via Developersdex http://www.developersdex.com *** |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
Try it like this entering the path for your pictures folder in textbox4
and the string that file names start with in textbox1. Check the name of the listbox. Private Sub CommandButton7_Click() Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Set objFSO = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set objFolder = objFSO.GetFolder(Me.TextBox4.Text) On Error GoTo 0 If Not objFolder Is Nothing Then For Each objFile In objFolder.Files If objFile.Type = "JPEG Image" And _ objFile.Name Like Me.TextBox1.Text & "*" Then Me.ListBox1.AddItem objFile.Name End If Next End If End Sub Regards Rowan ivica lopar wrote: Private Sub CommandButton7_Click() Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Set objFSO = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set objFolder = objFSO.GetFolder(Me.TextBox4.Text) On Error GoTo 0 If Not objFolder Is Nothing Then For Each objFile In objFolder.Files If objFile.Type = "JPEG Image" Then Me.list1.AddItem objFile.Name End If Next End If This is what I tryed but it did not work out lop *** Sent via Developersdex http://www.developersdex.com *** |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
Works perfect.All I need more to have path from TextBox4 in ListBox1 for
excample: D:\My Pictures\210345_65.jpeg D:\My Pictures\210346_65.jpeg regards lop *** Sent via Developersdex http://www.developersdex.com *** |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
Maybe:
Private Sub CommandButton7_Click() Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Set objFSO = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set objFolder = objFSO.GetFolder(Me.TextBox4.Text) On Error GoTo 0 If Not objFolder Is Nothing Then For Each objFile In objFolder.Files If objFile.Type = "JPEG Image" And _ objFile.Name Like Me.TextBox1.Text & "*" Then Me.ListBox1.AddItem Me.TextBox4.Text & objFile.Name 'or ' Me.ListBox1.AddItem Me.TextBox4.Text & " \" & objFile.Name End If Next End If End Sub Regards Rowan ivica lopar wrote: Works perfect.All I need more to have path from TextBox4 in ListBox1 for excample: D:\My Pictures\210345_65.jpeg D:\My Pictures\210346_65.jpeg regards lop *** Sent via Developersdex http://www.developersdex.com *** |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
I find solution by my self. I hope You will help me sometimes. Jop You do is fantasy. Thanks for help If you Regards lop *** Sent via Developersdex http://www.developersdex.com *** |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sime function to find files
Happy to help
Rowan ivica lopar wrote: I find solution by my self. I hope You will help me sometimes. Jop You do is fantasy. Thanks for help If you Regards lop *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Where is "open/tools/find/find files that match these criteria"? | Excel Discussion (Misc queries) | |||
Find Files | Excel Programming | |||
backwards find function to find character in a string of text | Excel Programming | |||
FileSearch doesn't find zip files | Excel Programming | |||
Import multiple files macro can't find files | Excel Programming |