Solved

Covert rtf to doc

Posted on 2008-10-17
7
421 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

 

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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
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.

751 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