nigelandrewfoster
Well-known Member
- Joined
- May 27, 2009
- Messages
- 747
Hello
A csv file I need to open contains quite a number of foreign characters. By default, opening it in Excel corrupts them.
I have been using this to open it (successfully, without corruption):
However, it creates a query link, which I don't actually need.
Please can you tell me how I might achieve the same result, but without creating the link?
Thanks for your time
Nigel
A csv file I need to open contains quite a number of foreign characters. By default, opening it in Excel corrupts them.
I have been using this to open it (successfully, without corruption):
Code:
Sub Open_CSV_Correctly()
Dim wb As Workbook
Dim strFile As String
strFile = "E:\MyFile.csv"
Set wb = Workbooks.Add
With wb.Worksheets(1)
With .QueryTables.Add(Connection:="TEXT;" & strFile, Destination:=.Range("A1"))
.TextFileParseType = xlDelimited
.TextFilePlatform = 65001
.TextFileCommaDelimiter = True
.Refresh
End With
End With
End Sub
However, it creates a query link, which I don't actually need.
Please can you tell me how I might achieve the same result, but without creating the link?
Thanks for your time
Nigel