• Home
  • Blog
  • Resume
  • Contact
  • Projects
  • Gallery
  • Amit’s Resume
  • About Nagpur
KEEP IN TOUCH

Get file names from a directory

Jul18
2007
Leave a Comment Written by admin

If you want get or print file names from a certain directory, then you can use following code.


Sub GetFileNames()
Dim sPath As String, sFileNm As String

sPath = “C:\DW\”
‘You can also use Application.GetOpenFilename to get a file name from a folder,
‘and then extract the Directory name from that string
‘You can also use filters with GetOpenFilenam such as *.txt, see Help on this topic

sFileNm = Dir(sPath, vbNormal) ‘Get the first file from the specified directory
‘Start a loop
Do While sFileNm “”
‘If the file has a dbf extension then print the file name
If Right(sFileNm, 3) = “dbf” Then
Debug.Print sFileNm
End If
sFileNm = Dir
Loop
End Sub

Related posts:

  1. Save HTML files from one folder to Excel files in another folder
  2. Send File Path-Email via Groupwise
  3. String Operations
Posted in Useful Procedures - Tagged VBA
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
« Range Concatenation with a character
» Access VBA: Link all Dbase files from a folder

No Comments Yet

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Tags

Access Alt F8 Books boxplot cells charts count cursor dashboard data mining dbase design error excel excel functions export filter flip LaTex MS query Number Err ODBC pipes Press Alt F11 Public Sub python R random numbers Range Cells report scripting software sparklines SQL SQL server stack columns statistics stemming string tag cloud text mining UDF VBA visualization wildcard

Network

View Ashutosh Nandeshwar's profile on LinkedIn

Recent Comments

  • W. McNabb on The search key was not found in any record in Access
  • Manuel on The search key was not found in any record in Access
  • Wendy Naples on The search key was not found in any record in Access
  • larry on Access Export to Excel (2007)
  • Betty Chou on Projects

Related Posts

  1. Save HTML files from one folder to Excel files in another folder
  2. Send File Path-Email via Groupwise
  3. String Operations

EvoLve theme by Blogatize  •  Powered by WordPress nandeshwar.info