I am searching for help once again. What I want to do is convert a certain file to a .txt Document MS-DOS Format. The file that I need to convert is coming from a Solaris machine, I want to parse that file and search for certain Item in order to construct a table. The thing is that when I use VBA to read the file line by line, I use the While(Not(EOF(fileHandle))), windows sees the file as one huge line, when in reality the file has 672 lines.
What I found out is that if I open the file using WordPad and save the Document as a Text Document-MS-Dos Format I am able see all the lines in the file. So what I am I need to know is if there is a way to convert a file to a Text Document-MS-Dos Format. So far I can create a txt document of the file that came out of the Solaris machine. But this is not enough, the file is still viewed as one big line. Here is what I have so far:
Function ConvertToTxt(strPath As String)
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) & "Copy.txt"
Else
strFileCopy = objFile.Name & "Copy.txt"
End If
'---Create a copy of the file with a .txt extension
objFile.Copy strFileCopy, True
lineRead = ReadWizardFile(strFileCopy)
MsgBox "Lines Read: " & lineRead & "", vbOKOnly
End Function
Thanks for all your help....
What I found out is that if I open the file using WordPad and save the Document as a Text Document-MS-Dos Format I am able see all the lines in the file. So what I am I need to know is if there is a way to convert a file to a Text Document-MS-Dos Format. So far I can create a txt document of the file that came out of the Solaris machine. But this is not enough, the file is still viewed as one big line. Here is what I have so far:
Function ConvertToTxt(strPath As String)
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) & "Copy.txt"
Else
strFileCopy = objFile.Name & "Copy.txt"
End If
'---Create a copy of the file with a .txt extension
objFile.Copy strFileCopy, True
lineRead = ReadWizardFile(strFileCopy)
MsgBox "Lines Read: " & lineRead & "", vbOKOnly
End Function
Thanks for all your help....