Why the file is saved in the different locations?
----------------
Sub DataImport(strPath As String, strTableName As String)
'Variables used to create and modify the file extension
Dim objFileSystem
Dim objFile
Dim strFileCopy As String
Dim intExtPosition As Integer
'Create an instance of the FileSystemObject to access
'the local file system
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
'Use the GetFile method to return a File object corresponding to the
'file in a specified path.
Set objFile = objFileSystem.GetFile(strPath)
intExtPosition = InStr(objFile.Name, ".")
If intExtPosition > 0 Then
strFileCopy = Left(objFile.Name, intExtPosition - 1) & ".txt"
Else
strFileCopy = objFile.Name & ".txt"
End If
'Create a copy of the file with a .txt extension
objFile.Copy strFileCopy, True
'DoCmd.TransferText acImportDelim, , strTableName, strFileCopy, True
End Sub
------------
The code is straightforward, but I don't understand why sometimes, when I run the code, the copy text file is saved in my current working directory (D:\VB6.0\Myfile.txt), and other times it is saved C:\MyDocument\Myfile.txt) ?
Can you tell my why and how to "force" it to be saved only in one specific location?
Thank you,
Curie

