Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Quick way(s) to view opened files | New Users to Excel | |||
just a quick one | Excel Discussion (Misc queries) | |||
I NEED HELP QUICK | Excel Discussion (Misc queries) | |||
HELP QUICK I NEED TO KNOW HOW TO ... | Excel Discussion (Misc queries) | |||
NEED HELP QUICK AGAIN! | Excel Discussion (Misc queries) |