Originally Posted by
p45cal
I will still try and tweak the macro solution to read this 65001-encoded text file - but I'm out of time just now.
It was easier than expected:
Sub blah2()
Dim at3() As String, objStream
With CreateObject("ADODB.Stream")
.Charset = "utf-8"
.Open
.LoadFromFile ("C:\Users\Public\Documents\dummy sentences.txt")
ct = .ReadText()
.Close
End With
Set Destn = ActiveSheet.Cells(1)
dt = Split(ct, vbCrLf)
j = 0
For Each bt In dt
at = Replace(Replace(Replace(Replace(bt, "...", "…¬"), ".", ".¬"), "?", "?¬"), "!", "!¬")
at2 = Split(at, "¬")
For i = 0 To UBound(at2)
at2(i) = Application.Trim(at2(i))
at2(i) = Replace(at2(i), "…", "...") 'optional to replace an ellipsis with 3 dots.
If Len(at2(i)) = 0 Then at2(i) = "¬"
ReDim Preserve at3(0 To j)
at3(j) = at2(i)
j = j + 1
Next i
Next bt
at3 = Filter(at3, "¬", False)
Destn.Resize(UBound(at3) + 1).Value = Application.Transpose(at3)
End Sub
Still interested in where these text files come from…