View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default 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