Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where is "open/tools/find/find files that match these criteria"? PJ Excel Discussion (Misc queries) 2 November 14th 08 04:11 PM
Find Files Bill[_30_] Excel Programming 5 September 2nd 05 07:36 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM
FileSearch doesn't find zip files Hub van de Laar Excel Programming 3 September 1st 03 07:43 PM
Import multiple files macro can't find files Steven Rosenberg Excel Programming 1 August 7th 03 01:47 AM


All times are GMT +1. The time now is 10:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"