PC Review


Reply
Thread Tools Rate Thread

CONVERT ASCII TO UTF WITH MACRO

 
 
sm416
Guest
Posts: n/a
 
      16th Jun 2008
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 NotePad 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 NotePad 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Macro to convert ASCII File to Excell Chip Pearson Microsoft Excel Programming 0 27th Jan 2010 09:18 PM
RE: Macro to convert ASCII File to Excell Matthew Herbert Microsoft Excel Programming 4 27th Jan 2010 02:49 AM
how to convert non-ISO extended-ASCII to ISO ascii dotNeter Microsoft Dot NET 1 29th Jun 2006 06:53 PM
How can I convert high ASCII to low ASCII Friso Wiskerke Microsoft VB .NET 6 7th Jan 2005 05:52 PM
Convert ASCII Jeremy Microsoft Dot NET Framework Forms 4 28th Nov 2003 05:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:37 AM.