Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all, I am working in Excel 2007 and I want macro to count all
"xlsx" fromat files in a folder and put that total count number in Range("A1"). I found macro (see below) but I am getting error message on line "With Application.FileSearch" saying "Run-time error 445 - Object doesn't support this action" Please can any friend can help me on this. 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I prevent Excel 2007 from leaving ".tmp" files in my folder | Excel Discussion (Misc queries) | |||
Open all excel files in the "volatile" folder | Excel Programming | |||
creating an XLS file from " files" data in a Folder | Excel Discussion (Misc queries) | |||
"Folder Select" Dialogue - Opening multiple files from selected folder | Excel Programming |