Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert RTF to TXT 1

Status
Not open for further replies.

ije

MIS
Jun 10, 2002
38
0
0
AU
Hello,

i require a method adoptable in VBScript to automatically convert a given RTF file into a TXT file. Does anyone have suggestions or proven methods?

many thanks
ije
 
I you can open a file for output in VBScript, you can do this.

Open the file in a richtextbox control named RTtemp.

from there do this

Open App.Path & "/temp.txt" for output as #1
print #1,RTtemp.Text
Close #1

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
You can do it easily if you have Microsoft Word installed on your computer. Try the following vbs code.
___
[tt]
ConvertRTF2TXT "C:\RichText.rtf", "C:\PoorText.txt"

Sub ConvertRTF2TXT(srcRTFfile, dstTXTfile)
Dim Word
Set Word = CreateObject("Word.Application")
Word.Documents.Open(srcRTFfile).SaveAs dstTXTfile, 2
Word.Quit
Set Word = Nothing
End Sub
[/tt]
 
Nice technique with the .Open.Save Hypetia. Thanks for showing it.
 
yes the open save using Word worked a treat. I still have to test on Citrix where it is also used, but from previous experience, it "should" be fine.

many thanks
ije.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top