Quote:
quote:So there is no way of using vba to change a file extension from .dat to .txt??
|
Sure there is:
Sub CopyFiles(strFilesToCopy As String, strDestinationDirectory As String)
' Call with CopyFiles "C:\Temp\*.dat", "C:\Temp"
Dim strSourceFile As String
Dim strDestinationFile As String
Dim strSourceDirectory As String ' "C:\Temp\"
strSourceDirectory = Left$(strFilesToCopy, (InStr(strFilesToCopy, "*") - 1))
strSourceFile = Dir(strFilesToCopy)
Do While strSourceFile <> ""
strDestinationFile = Replace$(strSourceFile, ".DAT", ".TXT")
FileCopy strSourceDirectory & strSourceFile, strDestinationDirectory & "\" & strDestinationFile
strSourceFile = Dir
Loop
End Sub
Not sure what the text file will look like in your case, but you may find, as hashtlishnii mentioned, that the .dat file is just a text file.
HTH,
Bob