Converting file.rtf to file.txt

A

Alogon

1. I would like to know how I can convert a file with RTF (Rith Text Format)
to a file with TXT extension using VBA code. I tried
"FileSystemObject.OpenAsTextFile " property but it did not work very well.

2. Is it possible to convert a file.RTF into file.XLS directly using VBA code?

Thanks.
 
G

Gary''s Student

Using Word as the VBA platform:

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 12/12/2008 by James Ravenswood
'
ChangeFileOpenDirectory "C:\test\"
Documents.Open FileName:="x.rtf", ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto


ActiveDocument.SaveAs FileName:="x.txt", FileFormat:=wdFormatText, _
LockComments:=False, Password:="", AddToRecentFiles:=True,
WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False,
SaveAsAOCELetter:= _
False, Encoding:=1252, InsertLineBreaks:=False,
AllowSubstitutions:=False _
, LineEnding:=wdCRLF
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