ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing a macro to save as Unicode text (https://www.excelbanter.com/excel-programming/288495-re-changing-macro-save-unicode-text.html)

Jim Rech

Changing a macro to save as Unicode text
 
You might try this:

Public Sub TextNoModification()
Dim Delimiter As String
Dim myRecord As Range
Dim myField As Range
Dim sOut As String
Delimiter = Chr(9)
Open "Test.txt" For Output As #1
For Each myRecord In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
With myRecord
For Each myField In Range(.Cells(1), Cells(.Row,
Columns.Count).End(xlToLeft))
sOut = sOut & Delimiter & StrConv(myField.Text, vbUnicode)
Next myField
Print #1, Mid(sOut, 2)
sOut = Empty
End With
Next myRecord
Close #1
End Sub

I changed how you were doing the delimiter too since it made no sense as the
literal text "CHR(9)"

--
Jim Rech
Excel MVP




All times are GMT +1. The time now is 05:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com