Thread: [Solved] Docx to rtf
View Single Post
 
Old 02-06-2022, 12:06 PM
ranjan ranjan is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: May 2021
Posts: 80
ranjan is on a distinguished road
Default Docx to rtf

I want to convert the active document from .docx to .rtf and save in the active document path and save with the same active document file name.

Example:-

Input: c:\123.docx

Output: c:\123.rtf

Please help me in this regard’s…

I tried the below one but am not getting the same active file name in the same path, could you help me in this regards.

Code:
Sub rtf_test()

Dim strFname As String
Dim oDoc As Document
Dim strPath As String

    strFname = "Filename" 
    Set oDoc = ActiveDocument
    strPath = ActiveDocument.path & "\"
    
   oDoc.SaveAs2 FileName:=strPath & "Filename.rtf", FileFormat:=wdFormatRTF
   
      
End Sub
Any help is highly appreciated...

Thank you so much.
Reply With Quote