ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Converting RTF file into TXT file (https://www.excelbanter.com/excel-programming/420752-converting-rtf-file-into-txt-file.html)

Alogon

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

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

Thanks In Advance.


joel

Converting RTF file into TXT file
 
You cxan use the code below to convert the rtf to text and then open the text
file

FName = "c:\temp\abc.rtf"
SaveFName = "c:\temp\abc.txt"
Set wordobj = GetObject(FName)
wordobj.SaveAs Filename:=SaveFName, _
FileFormat:=wdFormatText, _
InsertLineBreaks:=False, _
AllowSubstitutions:=False, _
LineEnding:=wdCRLF

"Alogon" wrote:

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

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

Thanks In Advance.



All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com