Convert ASCII to UTF-8 through a Macro

S

sm416

I would like to know the method that can be used, in a macro that will
convert a text file that is in ASCII to UTF-8. The current method that is
used is to open the text document in Word Pad and save as UTF-8. When the
macro is performed in Word all of the extra characters do not show up. I
made an attempt to record a macro, thru Word, to perform the above but
apparently because Word Pad is a separate application the method will not do
what I expect. Is there a field in the source code that I change change?
The macro is as follows:

Sub ecf_new_test()
'
' ecf_new_test Macro
'
'
ChangeFileOpenDirectory "U:\01 Text Files\"
Documents.Open FileName:="U:\01 Text Files\ecf1.txt",
ConfirmConversions:= _
False, ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto,
XMLTransform:="", _
Encoding:=65001
Selection.WholeStory
Selection.Font.Name = "Courier"
Selection.Font.Size = 7
With Selection.ParagraphFormat
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 12
End With
With Selection.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = InchesToPoints(0.5)
.BottomMargin = InchesToPoints(0.3)
.LeftMargin = InchesToPoints(0.3)
.RightMargin = InchesToPoints(0.2)
End With
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "LIGHT"
.Replacement.Text = ""
.Forward = True
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=vbTab & vbTab & vbTab & "Irradiation #" & vbTab
& _
"Magazine(s)"
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.TypeText Text:=vbTab & " "
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top