RE: Change File Extension before importing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Assuming all the files are in the same folder, you can use a combination of
the Dir function and the Replace function to rename all the files that end
with .dpr.

Dim strOldName as String
Dim strNewName as String
Dirm strFullName As String
Const conPath as String = "C:\SomeFolder\"

strFileName = Dir(conPath & "\*.dpr")
Do Until Len(strFileName) = 0
strOldName = conPath & strFileName
strNewName = Replace(strOldName,".dpr", ".txt")
Name strOldName As strNewName
strFileName = Dir
Loop
--
Dave Hargis, Microsoft Access MVP


"John W" wrote:

I've created a database that will take large quantities of delimited text
files and import them to Access. Everything is working fine but I'm
wondering if there's some code that would change the file extension before
importing? The files are all text but they come to us with a .dpr
extension. If it were just a few files it would be no problem to just
change them manually, but I'm dealing with hundreds of files per week. Is
this possible to do?

Thanks!



.



Relevant Pages

  • Re: Executing SQL DTS Package from Access
    ... Dim sMsg As String, sTitle As String, iStyle As Integer ... "SQL Server was Successful!" ... Doug Steele, Microsoft Access MVP ...
    (microsoft.public.access.formscoding)
  • Re: Error on UBound with Dynamic Array
    ... Doug Steele, Microsoft Access MVP ... determine the difference in length of the string. ... need to use a dynamic array and may be checking the boundries, ...
    (microsoft.public.access.modulesdaovba)
  • RE: Import Excel spreadsheet.
    ... Const conLinkedTable As String = "YourLinkedTableName" ... Dave Hargis, Microsoft Access MVP ... If I don't click the button and manually import the spreadsheet into ... Dim tdfs As TableDefs ...
    (microsoft.public.access.externaldata)
  • Re: How do I automate Outlook to send an e-mail using VBA? ... CDO
    ... Dim iConf As Object ... , pEmailAddress As String _ ... Microsoft Access MVP 2006 ... Set outMsg = outApp.CreateItem ...
    (microsoft.public.access.modulesdaovba)
  • Re: Shell function
    ... Doug Steele, Microsoft Access MVP ... ByVal lpOperation As String, _ ... Dim lRet As Long, varTaskID As Variant ...
    (microsoft.public.access.modulesdaovba)