Import Text with non-txt extentions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have multiple text files I need to import each month with a non-txt
extension. The problem is I need to manually change the extension to .txt for
each file before running my import macros. Is there any way to add text
import extensions within Access so access will recognize them as text thus
avoiding this manual step?
Thanks
Bob, NY
 
You can rename all the files in a directory with this. You could put this
behind a command button.

Private Sub Command1_Click()
Dim strfilename As String
strfilename = Dir("c:\DirName\*.*")

Do Until strfilename = ""
Name "c:\DirName\" & strfilename As "c:\testdir\" &strfilename&".txt"
strfilename = Dir
Loop
 
If it's not convenient to rename the fiels, this article
http://support.microsoft.com/?id=304206 shows how to change the
extensions that Access will accept. Minor changes may be needed if
you're using a version later than Access 2000.

Alternatively, this http://support.microsoft.com/?id=306144 includes
code that automatically makes a copy of the textfile with a .txt
extension and imports that. Can also be used when exporting.

On Sat, 24 Feb 2007 04:03:00 -0800, NY Bob <NY
 
Back
Top