Hello,
I'm having trouble figuring this one out. I have a text file, that will always have a tab before the first field header which shifts everything over when I import the file to Access. I'm looking for a way to get rid of this, but I'm not sure how to refer specifically to this tab only.
Here is the code I have in Access for opening the file, and making some other changes....
Dim FSO, objFile, RegEx, strDestin, strFile, strSource
Set FSO = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1
strSource = "\\moh\mohshare\CDSD\PHL\Labware Data Import\TB_Import_2010-06-10(raw)_2.txt"
strDestin = "C:\test.txt"
Set objFile = FSO.OpenTextFile(strSource, ForReading)
strFile = objFile.ReadAll
objFile.Close
strFile = Replace(strFile, Chr(13) & Chr(10), "xxxxxx")
strFile = Replace(strFile, "xxxxxx" & Chr(9), Chr(10))
strFile = Replace(strFile, "xxxxxx", " ")
Set objFile = FSO.CreateTextFile(strDestin, True)
objFile.Write strFile
objFile.Close
Any help is much appreciated!! Thanks
I'm having trouble figuring this one out. I have a text file, that will always have a tab before the first field header which shifts everything over when I import the file to Access. I'm looking for a way to get rid of this, but I'm not sure how to refer specifically to this tab only.
Here is the code I have in Access for opening the file, and making some other changes....
Dim FSO, objFile, RegEx, strDestin, strFile, strSource
Set FSO = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1
strSource = "\\moh\mohshare\CDSD\PHL\Labware Data Import\TB_Import_2010-06-10(raw)_2.txt"
strDestin = "C:\test.txt"
Set objFile = FSO.OpenTextFile(strSource, ForReading)
strFile = objFile.ReadAll
objFile.Close
strFile = Replace(strFile, Chr(13) & Chr(10), "xxxxxx")
strFile = Replace(strFile, "xxxxxx" & Chr(9), Chr(10))
strFile = Replace(strFile, "xxxxxx", " ")
Set objFile = FSO.CreateTextFile(strDestin, True)
objFile.Write strFile
objFile.Close
Any help is much appreciated!! Thanks