Solved

Covert rtf to doc

Posted on 2008-10-17
7
420 Views
Last Modified: 2012-05-05
i was wondering if there is a script that can be built to convert a directory filled with RTF files into word document. Im aware of the file>save as method of converting but our systems spit out RTFs and i was looking for a mass way of converting them all.
0
Comment
Question by:NSNR
  • 4
  • 3
7 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 200 total points
ID: 22740925
It is probably easier to use VBA to create a Word macro, than to use script.

This is in the form of a macro that needs to be called so:

ConfertFromRTF "C:\MyFolder")

Sub ConvertFromRtf(strFolder As String)
    Dim strFileName As String
    Dim Doc As Document
        
    strFileName = Dir$(strFolder & "\*.rtf", vbDirectory)
    Do Until strFileName = ""
        Set Doc = Documents.Open(strFolder & "\" & strFileName, False)
        Doc.SaveAs strFolder & "\" & Replace(strFileName, ".rtf", ".doc"), wdFormatDocument
        Doc.Close
        strFileName = Dir$()
    Loop
End Sub

Open in new window

0
 

Author Comment

by:NSNR
ID: 22741175
how would i use a macro for word?
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 22741959
To create the macro, Open Word and toggle to the VBA Editor window with Alt+ F11.

Locate your the Normal template in the left-hand Project pane. Open its contents with the little plus sign. If there is no 'folder' labelled modules, then, from the menu, do Insert/Module. Otherwise expand its contents and select one of the code modules.

Double-click on the new or existing code module to open it. Paste the code into the right-hand code pane.

Run it by clicking in the code to put the cursor in the module and then pressing F5.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:NSNR
ID: 22742879
is there any other way to convert RTF to DOC without using WORD as a medium?
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 22744444
You need something that can process both formats. Apart from Word, I understand that OpenOffice can do that, but I haven't seen it and I can't know if it can be automated.

Note that if you want to use VBScript, it will also have to use Word to do the actual conversion.

There might be something that will convert to the 2007 XML format, but it would need the compatibility utility to be readable in Word 2003.
0
 

Author Comment

by:NSNR
ID: 22769075
it doesnt have to be a vbscript.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 22769979
My point is that whatever language you use, it must be able to call upon a resource that knows how to create a Word document, unless, of course, you understand the Word document format and can program it directly.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question