G
Guest
Hi to All:
I have the below code that I am using to modify csv files from having "". I
am having two problems. The filenames for these files need to be consistant,
however the two statements I have marked with <Problem are not recognizing
the files. I am also trying to geth this to only run on Range A1. Can anyone
help?
Sub test2()
Const strFileIn As String = "I:\04 Production Files\IPEP Records\Cleaning
files\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Const strFileOut As String = "I:\04 Production Files\IPEP Records\Cleaned\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Dim FSO As Scripting.FileSystemObject
Dim fDest As Scripting.TextStream
Dim strData As String
Dim lngFNum1 As Long
Set FSO = New Scripting.FileSystemObject
Set fDest = FSO.CreateTextFile(strFileOut, True)<Problem
lngFNum1 = FreeFile()
Open strFileIn For Input As #lngFNum1<Problem
Do While Not EOF(lngFNum1)
Line Input #lngFNum1, strData
strData = Replace(strData, """", "", 1, -1, vbTextCompare)
fDest.WriteLine strData
Loop
Close
fDest.Close
End Sub
I liked the way you had everything directed in paths in the first set of
coding, but I am having a hard time get the areas above to recognize the
filenames. I have marked the ares with the word "<Problems". Do you have any
suggestions?
I have the below code that I am using to modify csv files from having "". I
am having two problems. The filenames for these files need to be consistant,
however the two statements I have marked with <Problem are not recognizing
the files. I am also trying to geth this to only run on Range A1. Can anyone
help?
Sub test2()
Const strFileIn As String = "I:\04 Production Files\IPEP Records\Cleaning
files\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Const strFileOut As String = "I:\04 Production Files\IPEP Records\Cleaned\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Dim FSO As Scripting.FileSystemObject
Dim fDest As Scripting.TextStream
Dim strData As String
Dim lngFNum1 As Long
Set FSO = New Scripting.FileSystemObject
Set fDest = FSO.CreateTextFile(strFileOut, True)<Problem
lngFNum1 = FreeFile()
Open strFileIn For Input As #lngFNum1<Problem
Do While Not EOF(lngFNum1)
Line Input #lngFNum1, strData
strData = Replace(strData, """", "", 1, -1, vbTextCompare)
fDest.WriteLine strData
Loop
Close
fDest.Close
End Sub
I liked the way you had everything directed in paths in the first set of
coding, but I am having a hard time get the areas above to recognize the
filenames. I have marked the ares with the word "<Problems". Do you have any
suggestions?