Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default How to select Excel files ONLY

My Function (below) is working fine -- I'm just using it by entering
=FileCount(Test) -- I see there are optional parameters to refine selection
but don't understand what I am to enter.. What should I do in order
to select ONLY *.xls files?
TIA,
Jim

Only First three lines...
Function FileCount(FolderName As String, _
Optional FileFilter As String = "*", Optional FileType As MsoFileType =
msoFileTypeExcelWorkbooks) As Long
With Application.FileSearch
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default How to select Excel files ONLY

Change Optional FileFilter As String = "*", to
Optional FileFilter As String = "*.xls",
That's it

Charles
xl Geek

Jim May wrote:
My Function (below) is working fine -- I'm just using it by entering
=FileCount(Test) -- I see there are optional parameters to refine selection
but don't understand what I am to enter.. What should I do in order
to select ONLY *.xls files?
TIA,
Jim

Only First three lines...
Function FileCount(FolderName As String, _
Optional FileFilter As String = "*", Optional FileType As MsoFileType =
msoFileTypeExcelWorkbooks) As Long
With Application.FileSearch


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default How to select Excel files ONLY

much obilged,
Jim

"Die_Another_Day" wrote:

Change Optional FileFilter As String = "*", to
Optional FileFilter As String = "*.xls",
That's it

Charles
xl Geek

Jim May wrote:
My Function (below) is working fine -- I'm just using it by entering
=FileCount(Test) -- I see there are optional parameters to refine selection
but don't understand what I am to enter.. What should I do in order
to select ONLY *.xls files?
TIA,
Jim

Only First three lines...
Function FileCount(FolderName As String, _
Optional FileFilter As String = "*", Optional FileType As MsoFileType =
msoFileTypeExcelWorkbooks) As Long
With Application.FileSearch



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How to select Excel files ONLY

Jim,
call the function specifying a FileFilter to override the default.
==FileCount(Test,"*.xls")

NickHK
P.S. Many people find the .FileSearch somewhat flakey in it's results; you
may or may not get the correct result returned.
You could easily rewrite the function using VBA's Dir() function to
guarantee consistent results.

"Jim May" wrote in message
...
My Function (below) is working fine -- I'm just using it by entering
=FileCount(Test) -- I see there are optional parameters to refine

selection
but don't understand what I am to enter.. What should I do in order
to select ONLY *.xls files?
TIA,
Jim

Only First three lines...
Function FileCount(FolderName As String, _
Optional FileFilter As String = "*", Optional FileType As MsoFileType =
msoFileTypeExcelWorkbooks) As Long
With Application.FileSearch



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 does Excel2007 save files -- not where I select? Dick Excel Worksheet Functions 1 October 16th 09 03:13 AM
Select a file out of a list of files Michael Wise[_34_] Excel Programming 1 May 1st 06 07:38 PM
How do I set up a form to select files from greaseman[_5_] Excel Programming 3 April 10th 06 10:10 PM
Use Macro to Select All Files Within A Folder Theresa Excel Programming 7 October 20th 05 03:21 AM
Select Text Files from Combobox D.Parker Excel Discussion (Misc queries) 4 June 28th 05 03:46 PM


All times are GMT +1. The time now is 09:35 PM.

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"