PC Review


Reply
Thread Tools Rate Thread

"Basic File Search"

 
 
Fawn
Guest
Posts: n/a
 
      6th Apr 2008
I am in an excel class for school. We are learning out of an excel '03 book,
yet I have an '07 program. As part of my studies I am use the "File Search"
command. I used the interactive excel program and it stated that the '07
does not have this command. Yeah, I need help. I cannot finish this program
w/out this command. I need to use this to find 3 previous files created and
put them all into one new workbook
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      6th Apr 2008
Are you looking in one directory or multiple directories? The DIR() function
may work. I need more details on your search to give you the right answer. I
have lots of code that does File Searches without the File Search function.
Are you just looking for names of files or are you looking at the dates as
well? I should be able to quickly give you the right code when I get the
details.

"Fawn" wrote:

> I am in an excel class for school. We are learning out of an excel '03 book,
> yet I have an '07 program. As part of my studies I am use the "File Search"
> command. I used the interactive excel program and it stated that the '07
> does not have this command. Yeah, I need help. I cannot finish this program
> w/out this command. I need to use this to find 3 previous files created and
> put them all into one new workbook

 
Reply With Quote
 
Fawn
Guest
Posts: n/a
 
      6th Apr 2008
The books states to use the File Search command and when it displays the
"Basic File Search" task pane to type in AWI (which is short for awsome
images) which are the previous files I need to retreive on my thumb drive.
It then states that the box will be on the right of the screen and that I
should just select the drive I need and under that in a sub catorgory will be
the files I need. I am then to "arrange" them in a vertical fashion. So in
the end I will have the blank work and the 4 workbooks.

I hope this helps you. Thank you so much for your help

"Joel" wrote:

> Are you looking in one directory or multiple directories? The DIR() function
> may work. I need more details on your search to give you the right answer. I
> have lots of code that does File Searches without the File Search function.
> Are you just looking for names of files or are you looking at the dates as
> well? I should be able to quickly give you the right code when I get the
> details.
>
> "Fawn" wrote:
>
> > I am in an excel class for school. We are learning out of an excel '03 book,
> > yet I have an '07 program. As part of my studies I am use the "File Search"
> > command. I used the interactive excel program and it stated that the '07
> > does not have this command. Yeah, I need help. I cannot finish this program
> > w/out this command. I need to use this to find 3 previous files created and
> > put them all into one new workbook

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      6th Apr 2008
Try this code. Change the folder name as required. The code below will find
and open all .XLS files in the folder selected.



Sub test2()

Const folder = "c:\temp"
First = True
Do
If First = True Then
FName = Dir(folder & "\*.xls")
First = False
Else
FName = Dir()
End If
If FName <> "" Then
Workbooks.Open Filename:=folder & "\" & FName
End If
Loop While FName <> ""


End Sub


"Fawn" wrote:

> The books states to use the File Search command and when it displays the
> "Basic File Search" task pane to type in AWI (which is short for awsome
> images) which are the previous files I need to retreive on my thumb drive.
> It then states that the box will be on the right of the screen and that I
> should just select the drive I need and under that in a sub catorgory will be
> the files I need. I am then to "arrange" them in a vertical fashion. So in
> the end I will have the blank work and the 4 workbooks.
>
> I hope this helps you. Thank you so much for your help
>
> "Joel" wrote:
>
> > Are you looking in one directory or multiple directories? The DIR() function
> > may work. I need more details on your search to give you the right answer. I
> > have lots of code that does File Searches without the File Search function.
> > Are you just looking for names of files or are you looking at the dates as
> > well? I should be able to quickly give you the right code when I get the
> > details.
> >
> > "Fawn" wrote:
> >
> > > I am in an excel class for school. We are learning out of an excel '03 book,
> > > yet I have an '07 program. As part of my studies I am use the "File Search"
> > > command. I used the interactive excel program and it stated that the '07
> > > does not have this command. Yeah, I need help. I cannot finish this program
> > > w/out this command. I need to use this to find 3 previous files created and
> > > put them all into one new workbook

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      6th Apr 2008
I modified my code to have a pop up window to select the folder rather then
have the folder hard coded


Sub test3()

Dim objShell As Object, objFolder As Object

Set objShell = CreateObject("Shell.Application")
On Error Resume Next

Set objFolder = objShell.BrowseForFolder(&H0&, "Select Folder ", &H1&)
If Not objFolder Is Nothing Then
Set oFolderItem = objFolder.Items.Item
folder = oFolderItem.Path

First = True
Do
If First = True Then
FName = Dir(folder & "\*.xls")
First = False
Else
FName = Dir()
End If
If FName <> "" Then
Workbooks.Open Filename:=folder & "\" & FName
End If
Loop While FName <> ""

End If

End Sub

"Fawn" wrote:

> The books states to use the File Search command and when it displays the
> "Basic File Search" task pane to type in AWI (which is short for awsome
> images) which are the previous files I need to retreive on my thumb drive.
> It then states that the box will be on the right of the screen and that I
> should just select the drive I need and under that in a sub catorgory will be
> the files I need. I am then to "arrange" them in a vertical fashion. So in
> the end I will have the blank work and the 4 workbooks.
>
> I hope this helps you. Thank you so much for your help
>
> "Joel" wrote:
>
> > Are you looking in one directory or multiple directories? The DIR() function
> > may work. I need more details on your search to give you the right answer. I
> > have lots of code that does File Searches without the File Search function.
> > Are you just looking for names of files or are you looking at the dates as
> > well? I should be able to quickly give you the right code when I get the
> > details.
> >
> > "Fawn" wrote:
> >
> > > I am in an excel class for school. We are learning out of an excel '03 book,
> > > yet I have an '07 program. As part of my studies I am use the "File Search"
> > > command. I used the interactive excel program and it stated that the '07
> > > does not have this command. Yeah, I need help. I cannot finish this program
> > > w/out this command. I need to use this to find 3 previous files created and
> > > put them all into one new workbook

 
Reply With Quote
 
Fawn
Guest
Posts: n/a
 
      6th Apr 2008
I'm a little confused. How do I use this?

"Joel" wrote:

> I modified my code to have a pop up window to select the folder rather then
> have the folder hard coded
>
>
> Sub test3()
>
> Dim objShell As Object, objFolder As Object
>
> Set objShell = CreateObject("Shell.Application")
> On Error Resume Next
>
> Set objFolder = objShell.BrowseForFolder(&H0&, "Select Folder ", &H1&)
> If Not objFolder Is Nothing Then
> Set oFolderItem = objFolder.Items.Item
> folder = oFolderItem.Path
>
> First = True
> Do
> If First = True Then
> FName = Dir(folder & "\*.xls")
> First = False
> Else
> FName = Dir()
> End If
> If FName <> "" Then
> Workbooks.Open Filename:=folder & "\" & FName
> End If
> Loop While FName <> ""
>
> End If
>
> End Sub
>
> "Fawn" wrote:
>
> > The books states to use the File Search command and when it displays the
> > "Basic File Search" task pane to type in AWI (which is short for awsome
> > images) which are the previous files I need to retreive on my thumb drive.
> > It then states that the box will be on the right of the screen and that I
> > should just select the drive I need and under that in a sub catorgory will be
> > the files I need. I am then to "arrange" them in a vertical fashion. So in
> > the end I will have the blank work and the 4 workbooks.
> >
> > I hope this helps you. Thank you so much for your help
> >
> > "Joel" wrote:
> >
> > > Are you looking in one directory or multiple directories? The DIR() function
> > > may work. I need more details on your search to give you the right answer. I
> > > have lots of code that does File Searches without the File Search function.
> > > Are you just looking for names of files or are you looking at the dates as
> > > well? I should be able to quickly give you the right code when I get the
> > > details.
> > >
> > > "Fawn" wrote:
> > >
> > > > I am in an excel class for school. We are learning out of an excel '03 book,
> > > > yet I have an '07 program. As part of my studies I am use the "File Search"
> > > > command. I used the interactive excel program and it stated that the '07
> > > > does not have this command. Yeah, I need help. I cannot finish this program
> > > > w/out this command. I need to use this to find 3 previous files created and
> > > > put them all into one new workbook

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      6th Apr 2008
I'm a little bit confused also. AWI seems to be picture files and you said
that four workbook will be opened.

Let me explain the code
this part of the fde gets the folder name FOLDER

Set objFolder = objShell.BrowseForFolder(&H0&, "Select Folder ", &H1&)
If Not objFolder Is Nothing Then
Set oFolderItem = objFolder.Items.Item
folder = oFolderItem.Path 'gets a folder name

This line of code sets up the DIR function on which filenames to return. It
is the same thing if you did a file search "c:\temp\*.xls". This will return
all files with these criteria

First Time
FName = Dir(folder & "\*.xls")
other times
FName = Dir

When Dir is used the first time you include the criteria for the search and
it returns the frist file with the criteria. All other times you don't have
any parameters so it returns all the other filenames with the criteria. I
use the variable First to distinquish between the first time DIR is called
and the other times.

The rest of the code just loops and opens each of the files using the FName
returned from the DIR function.

Workbooks.Open Filename:=folder & "\" & FName


When my code is finished you will have all the workbooks opend.

"Fawn" wrote:

> I'm a little confused. How do I use this?
>
> "Joel" wrote:
>
> > I modified my code to have a pop up window to select the folder rather then
> > have the folder hard coded
> >
> >
> > Sub test3()
> >
> > Dim objShell As Object, objFolder As Object
> >
> > Set objShell = CreateObject("Shell.Application")
> > On Error Resume Next
> >
> > Set objFolder = objShell.BrowseForFolder(&H0&, "Select Folder ", &H1&)
> > If Not objFolder Is Nothing Then
> > Set oFolderItem = objFolder.Items.Item
> > folder = oFolderItem.Path
> >
> > First = True
> > Do
> > If First = True Then
> > FName = Dir(folder & "\*.xls")
> > First = False
> > Else
> > FName = Dir()
> > End If
> > If FName <> "" Then
> > Workbooks.Open Filename:=folder & "\" & FName
> > End If
> > Loop While FName <> ""
> >
> > End If
> >
> > End Sub
> >
> > "Fawn" wrote:
> >
> > > The books states to use the File Search command and when it displays the
> > > "Basic File Search" task pane to type in AWI (which is short for awsome
> > > images) which are the previous files I need to retreive on my thumb drive.
> > > It then states that the box will be on the right of the screen and that I
> > > should just select the drive I need and under that in a sub catorgory will be
> > > the files I need. I am then to "arrange" them in a vertical fashion. So in
> > > the end I will have the blank work and the 4 workbooks.
> > >
> > > I hope this helps you. Thank you so much for your help
> > >
> > > "Joel" wrote:
> > >
> > > > Are you looking in one directory or multiple directories? The DIR() function
> > > > may work. I need more details on your search to give you the right answer. I
> > > > have lots of code that does File Searches without the File Search function.
> > > > Are you just looking for names of files or are you looking at the dates as
> > > > well? I should be able to quickly give you the right code when I get the
> > > > details.
> > > >
> > > > "Fawn" wrote:
> > > >
> > > > > I am in an excel class for school. We are learning out of an excel '03 book,
> > > > > yet I have an '07 program. As part of my studies I am use the "File Search"
> > > > > command. I used the interactive excel program and it stated that the '07
> > > > > does not have this command. Yeah, I need help. I cannot finish this program
> > > > > w/out this command. I need to use this to find 3 previous files created and
> > > > > put them all into one new workbook

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      6th Apr 2008
If you aren't interested in doing macro programming then use the Search
feature in Windows Explorer.

If you right click on the start button select explore
Then locate the directory of the files and simply double click on each of
the files you need to open.

"Joel" wrote:

> I'm a little bit confused also. AWI seems to be picture files and you said
> that four workbook will be opened.
>
> Let me explain the code
> this part of the fde gets the folder name FOLDER
>
> Set objFolder = objShell.BrowseForFolder(&H0&, "Select Folder ", &H1&)
> If Not objFolder Is Nothing Then
> Set oFolderItem = objFolder.Items.Item
> folder = oFolderItem.Path 'gets a folder name
>
> This line of code sets up the DIR function on which filenames to return. It
> is the same thing if you did a file search "c:\temp\*.xls". This will return
> all files with these criteria
>
> First Time
> FName = Dir(folder & "\*.xls")
> other times
> FName = Dir
>
> When Dir is used the first time you include the criteria for the search and
> it returns the frist file with the criteria. All other times you don't have
> any parameters so it returns all the other filenames with the criteria. I
> use the variable First to distinquish between the first time DIR is called
> and the other times.
>
> The rest of the code just loops and opens each of the files using the FName
> returned from the DIR function.
>
> Workbooks.Open Filename:=folder & "\" & FName
>
>
> When my code is finished you will have all the workbooks opend.
>
> "Fawn" wrote:
>
> > I'm a little confused. How do I use this?
> >
> > "Joel" wrote:
> >
> > > I modified my code to have a pop up window to select the folder rather then
> > > have the folder hard coded
> > >
> > >
> > > Sub test3()
> > >
> > > Dim objShell As Object, objFolder As Object
> > >
> > > Set objShell = CreateObject("Shell.Application")
> > > On Error Resume Next
> > >
> > > Set objFolder = objShell.BrowseForFolder(&H0&, "Select Folder ", &H1&)
> > > If Not objFolder Is Nothing Then
> > > Set oFolderItem = objFolder.Items.Item
> > > folder = oFolderItem.Path
> > >
> > > First = True
> > > Do
> > > If First = True Then
> > > FName = Dir(folder & "\*.xls")
> > > First = False
> > > Else
> > > FName = Dir()
> > > End If
> > > If FName <> "" Then
> > > Workbooks.Open Filename:=folder & "\" & FName
> > > End If
> > > Loop While FName <> ""
> > >
> > > End If
> > >
> > > End Sub
> > >
> > > "Fawn" wrote:
> > >
> > > > The books states to use the File Search command and when it displays the
> > > > "Basic File Search" task pane to type in AWI (which is short for awsome
> > > > images) which are the previous files I need to retreive on my thumb drive.
> > > > It then states that the box will be on the right of the screen and that I
> > > > should just select the drive I need and under that in a sub catorgory will be
> > > > the files I need. I am then to "arrange" them in a vertical fashion. So in
> > > > the end I will have the blank work and the 4 workbooks.
> > > >
> > > > I hope this helps you. Thank you so much for your help
> > > >
> > > > "Joel" wrote:
> > > >
> > > > > Are you looking in one directory or multiple directories? The DIR() function
> > > > > may work. I need more details on your search to give you the right answer. I
> > > > > have lots of code that does File Searches without the File Search function.
> > > > > Are you just looking for names of files or are you looking at the dates as
> > > > > well? I should be able to quickly give you the right code when I get the
> > > > > details.
> > > > >
> > > > > "Fawn" wrote:
> > > > >
> > > > > > I am in an excel class for school. We are learning out of an excel '03 book,
> > > > > > yet I have an '07 program. As part of my studies I am use the "File Search"
> > > > > > command. I used the interactive excel program and it stated that the '07
> > > > > > does not have this command. Yeah, I need help. I cannot finish this program
> > > > > > w/out this command. I need to use this to find 3 previous files created and
> > > > > > put them all into one new workbook

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      6th Apr 2008
The OP started a new tread in .worksheet.functions.

Thought you'd want to know.

Joel wrote:
>
> If you aren't interested in doing macro programming then use the Search
> feature in Windows Explorer.
>
> If you right click on the start button select explore
> Then locate the directory of the files and simply double click on each of
> the files you need to open.
>
> "Joel" wrote:
>
> > I'm a little bit confused also. AWI seems to be picture files and you said
> > that four workbook will be opened.
> >
> > Let me explain the code
> > this part of the fde gets the folder name FOLDER
> >
> > Set objFolder = objShell.BrowseForFolder(&H0&, "Select Folder ", &H1&)
> > If Not objFolder Is Nothing Then
> > Set oFolderItem = objFolder.Items.Item
> > folder = oFolderItem.Path 'gets a folder name
> >
> > This line of code sets up the DIR function on which filenames to return. It
> > is the same thing if you did a file search "c:\temp\*.xls". This will return
> > all files with these criteria
> >
> > First Time
> > FName = Dir(folder & "\*.xls")
> > other times
> > FName = Dir
> >
> > When Dir is used the first time you include the criteria for the search and
> > it returns the frist file with the criteria. All other times you don't have
> > any parameters so it returns all the other filenames with the criteria. I
> > use the variable First to distinquish between the first time DIR is called
> > and the other times.
> >
> > The rest of the code just loops and opens each of the files using the FName
> > returned from the DIR function.
> >
> > Workbooks.Open Filename:=folder & "\" & FName
> >
> >
> > When my code is finished you will have all the workbooks opend.
> >
> > "Fawn" wrote:
> >
> > > I'm a little confused. How do I use this?
> > >
> > > "Joel" wrote:
> > >
> > > > I modified my code to have a pop up window to select the folder rather then
> > > > have the folder hard coded
> > > >
> > > >
> > > > Sub test3()
> > > >
> > > > Dim objShell As Object, objFolder As Object
> > > >
> > > > Set objShell = CreateObject("Shell.Application")
> > > > On Error Resume Next
> > > >
> > > > Set objFolder = objShell.BrowseForFolder(&H0&, "Select Folder ", &H1&)
> > > > If Not objFolder Is Nothing Then
> > > > Set oFolderItem = objFolder.Items.Item
> > > > folder = oFolderItem.Path
> > > >
> > > > First = True
> > > > Do
> > > > If First = True Then
> > > > FName = Dir(folder & "\*.xls")
> > > > First = False
> > > > Else
> > > > FName = Dir()
> > > > End If
> > > > If FName <> "" Then
> > > > Workbooks.Open Filename:=folder & "\" & FName
> > > > End If
> > > > Loop While FName <> ""
> > > >
> > > > End If
> > > >
> > > > End Sub
> > > >
> > > > "Fawn" wrote:
> > > >
> > > > > The books states to use the File Search command and when it displays the
> > > > > "Basic File Search" task pane to type in AWI (which is short for awsome
> > > > > images) which are the previous files I need to retreive on my thumb drive.
> > > > > It then states that the box will be on the right of the screen and that I
> > > > > should just select the drive I need and under that in a sub catorgory will be
> > > > > the files I need. I am then to "arrange" them in a vertical fashion. So in
> > > > > the end I will have the blank work and the 4 workbooks.
> > > > >
> > > > > I hope this helps you. Thank you so much for your help
> > > > >
> > > > > "Joel" wrote:
> > > > >
> > > > > > Are you looking in one directory or multiple directories? The DIR() function
> > > > > > may work. I need more details on your search to give you the right answer. I
> > > > > > have lots of code that does File Searches without the File Search function.
> > > > > > Are you just looking for names of files or are you looking at the dates as
> > > > > > well? I should be able to quickly give you the right code when I get the
> > > > > > details.
> > > > > >
> > > > > > "Fawn" wrote:
> > > > > >
> > > > > > > I am in an excel class for school. We are learning out of an excel '03 book,
> > > > > > > yet I have an '07 program. As part of my studies I am use the "File Search"
> > > > > > > command. I used the interactive excel program and it stated that the '07
> > > > > > > does not have this command. Yeah, I need help. I cannot finish this program
> > > > > > > w/out this command. I need to use this to find 3 previous files created and
> > > > > > > put them all into one new workbook


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Long file names=off, dir name with repetitious char like (50)length. ""Search will not work in that dir "" pzam Windows Vista File Management 0 17th Jan 2009 05:04 PM
Why can't I do a "basic search" of my computer in Excel 2007 =?Utf-8?B?VG9tX2luX05ld19NZXhpY28=?= Microsoft Excel New Users 0 15th May 2007 06:11 PM
XP Basic search tool - how to search for specific string. Eg: "Lost In Space" MicroMain Windows XP General 3 8th Mar 2006 04:21 AM
Clicking File Folder defaults to "Search" instead of "Open" Anticrombie Windows XP General 5 22nd Apr 2004 04:30 AM
Re: How to make the "search text" feature work with non "txt" file Sharon F Windows XP Basics 0 30th Jun 2003 08:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:18 AM.