ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   List files in a directory (https://www.excelbanter.com/excel-programming/427899-list-files-directory.html)

David

List files in a directory
 
Hi Group,

I am trying to get a list of files in the directory c:/Documents and
setting/My Documents/TestExcel

and open all of them.

Thanks,
David

Jacob Skaria

List files in a directory
 
Sub FindFiles()
Dim strFile
Dim strFolder

strFolder = "c:\Documents and setting\My Documents\TestExcel\"
strFile = Dir(strFolder & "*.*", vbNormal)
Do While strFile < ""

Msbgox strFile
'do something

strFile = Dir
Loop

End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"David" wrote:

Hi Group,

I am trying to get a list of files in the directory c:/Documents and
setting/My Documents/TestExcel

and open all of them.

Thanks,
David


David

List files in a directory
 
Hi Jacob,

Thank you very much, this is perfect!

Sincerely,
David

"Jacob Skaria" wrote:

Sub FindFiles()
Dim strFile
Dim strFolder

strFolder = "c:\Documents and setting\My Documents\TestExcel\"
strFile = Dir(strFolder & "*.*", vbNormal)
Do While strFile < ""

Msbgox strFile
'do something

strFile = Dir
Loop

End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"David" wrote:

Hi Group,

I am trying to get a list of files in the directory c:/Documents and
setting/My Documents/TestExcel

and open all of them.

Thanks,
David



All times are GMT +1. The time now is 05:49 AM.

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