![]() |
Quick Q files in a dir
Can anyone suggest a snipit of code to see how many files
are in a dir called, the dir would be a variable called foldername. Many thanks in advance |
Quick Q files in a dir
Try this Neil
Sub test() Dim foldername As String foldername = "C:\Data" With Application.FileSearch .NewSearch .LookIn = foldername .SearchSubFolders = False .FileType = msoFileTypeExcelWorkbooks If .Execute() 0 Then MsgBox .FoundFiles.Count & " Excel files were found" Else MsgBox "There were no files found." End If End With End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Neil" wrote in message ... Can anyone suggest a snipit of code to see how many files are in a dir called, the dir would be a variable called foldername. Many thanks in advance |
Quick Q files in a dir
Thanks Ron,
Whats the msoFileType equivalent of *.*, i.e. all files ? -----Original Message----- Try this Neil Sub test() Dim foldername As String foldername = "C:\Data" With Application.FileSearch .NewSearch .LookIn = foldername .SearchSubFolders = False .FileType = msoFileTypeExcelWorkbooks If .Execute() 0 Then MsgBox .FoundFiles.Count & " Excel files were found" Else MsgBox "There were no files found." End If End With End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Neil" wrote in message ... Can anyone suggest a snipit of code to see how many files are in a dir called, the dir would be a variable called foldername. Many thanks in advance . |
Quick Q files in a dir
Whats the msoFileType equivalent of *.*, i.e. all files ?
msoFileTypeAllFiles From the VBA help MsoFileType can be one of these MsoFileType constants. msoFileTypeAllFiles msoFileTypeBinders msoFileTypeCalendarItem msoFileTypeContactItem msoFileTypeCustom msoFileTypeDatabases msoFileTypeDataConnectionFiles msoFileTypeDesignerFiles msoFileTypeDocumentImagingFiles msoFileTypeExcelWorkbooks msoFileTypeJournalItem msoFileTypeMailItem msoFileTypeNoteItem msoFileTypeOfficeFiles msoFileTypeOutlookItems msoFileTypePhotoDrawFiles msoFileTypePowerPointPresentations msoFileTypeProjectFiles msoFileTypePublisherFiles msoFileTypeTaskItem msoFileTypeTemplates msoFileTypeVisioFiles msoFileTypeWebPages msoFileTypeWordDocuments -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "neil" wrote in message ... Thanks Ron, Whats the msoFileType equivalent of *.*, i.e. all files ? -----Original Message----- Try this Neil Sub test() Dim foldername As String foldername = "C:\Data" With Application.FileSearch .NewSearch .LookIn = foldername .SearchSubFolders = False .FileType = msoFileTypeExcelWorkbooks If .Execute() 0 Then MsgBox .FoundFiles.Count & " Excel files were found" Else MsgBox "There were no files found." End If End With End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Neil" wrote in message ... Can anyone suggest a snipit of code to see how many files are in a dir called, the dir would be a variable called foldername. Many thanks in advance . |
All times are GMT +1. The time now is 10:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com