File Listing in a Directory
Dear Rick
I am sorry. When replying it did not occur I was going to annoy senior
Programmers. I am very sorry. For future questions I will clearly state the
Excel version.
Yours Sincerely
M Varnendra
"Rick Rothstein" wrote:
For future questions you might ask... it is always a good idea to mention
the version of Excel you are using.
--
Rick (MVP - Excel)
"Varne" wrote in message
...
Thanks everyone. I used a 2007 Excel application.
Jacob. Special thanks to you. Your codes do the list.
M Varnendra
"Jacob Skaria" wrote:
Works find in 2003..You must be using 2007. Try the below
Sub FileList()
Dim strFile As string
Dim strFolder As string
strFolder = "c:\"
strFile = Dir("c:\*.*", vbNormal)
Do While strFile < ""
MsgBox strFolder & strFile
strFile = Dir
Loop
End Sub
If this post helps click Yes
---------------
Jacob Skaria
"Varne" wrote:
Hi!
Could someone tell me whats wrong with these codes?
Sub FileList()
Dim File As Variant
With Application.FileSearch
.LookIn = "C:\"
.FileType = msoFileTypeAllFiles
.Execute
For Each File In .FoundFiles
MsgBox File
Next File
End With
End Sub
Run Time Error 445 - Object does not support this action!
Thanks
|