Solved

Covert rtf to doc

Posted on 2008-10-17
7
417 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
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 walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now