Solved

Covert rtf to doc

Posted on 2008-10-17
7
416 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
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 and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

708 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

12 Experts available now in Live!

Get 1:1 Help Now