ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Status Bar... (https://www.excelbanter.com/excel-programming/279431-status-bar.html)

James Weaver

Status Bar...
 
I am using the following code to identify the filenames in
a specified directory:

myFNames = Dir("*.xls")

Is there any way of counting how many files this
comprises? I want to have the status bar showing an
update of what is going on behind the scenes...

Hope you can help!

Many thanks,
James


Don Guillett[_4_]

Status Bar...
 
Maybe this will help

http://tinyurl.com/qrbr
"James Weaver" wrote in message
...
I am using the following code to identify the filenames in
a specified directory:

myFNames = Dir("*.xls")

Is there any way of counting how many files this
comprises? I want to have the status bar showing an
update of what is going on behind the scenes...

Hope you can help!

Many thanks,
James




Ron de Bruin

Status Bar...
 
One way

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



"James Weaver" wrote in message ...
I am using the following code to identify the filenames in
a specified directory:

myFNames = Dir("*.xls")

Is there any way of counting how many files this
comprises? I want to have the status bar showing an
update of what is going on behind the scenes...

Hope you can help!

Many thanks,
James




Bob Phillips[_5_]

Status Bar...
 
James,

Try using FileSearch

With Application.FileSearch
.NewSearch
.LookIn = "d:\Bob\My Documents\My Spreadsheets"
.SearchSubFolders = False ' True to include subfolders
.Filename = "*.xls"
.MatchTextExactly = True
.FileType = msoFileTypeExcelWorkbooks
.Execute
myFNames = .FoundFiles.Count
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"James Weaver" wrote in message
...
I am using the following code to identify the filenames in
a specified directory:

myFNames = Dir("*.xls")

Is there any way of counting how many files this
comprises? I want to have the status bar showing an
update of what is going on behind the scenes...

Hope you can help!

Many thanks,
James





All times are GMT +1. The time now is 06:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com