When I import a text file its also importing BOM characters ie: 
Which is giving me errors with other macros.
How can I modify the following code to exclude these character markings?
Thanks for any help
Jeff
When I import a text file its also importing BOM characters ie: 
Which is giving me errors with other macros.
How can I modify the following code to exclude these character markings?
Thanks for any help
Jeff
Re: Remove BOM characters
try to open and read the file
Set ImpRng = ActiveCell
Open "Z:\ImoprtFiles\Text_00.txt" For Input As #1
r = 0
Do While Not EOF(1)
Line Input #1, data
ActiveCell.Offset(r, 0) = data
r = r + 1
Loop
Close #1
or
r = 0
c = 0
txt = ""
Application.ScreenUpdating = False
Do While Not EOF(1)
Line Input #1, data
For i = 1 To Len(data)
char = Mid(data, i, 1)
If char = "," Or i = Len(data) Then
ActiveCell.Offset(r, c) = txt
c = c + 1
txt = ""
Else
If char <> Chr(34) Then _
txt = txt & Mid(data, i, 1)
End If
Next i
c = 0
r = r + 1
Loop
Close #1
Application.ScreenUpdating = True
Display More
Re: Remove BOM characters
Thanks pike.. couldn't get either one to work.. getting an error upon importing.
However I managed to fix my problem. Discovered my text files were somehow being saved as UTF-8. Manually re saved each file individually as ANSI .. a major pain but it worked.
Thanks for the help!
Jeff
Don’t have an account yet? Register yourself now and be a part of our community!