![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 12:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com