eric55
asked on
How do i convert .rtf Into .doc
Hi i need to convert some .rtf files to .doc is there a free way to do if not whats my options i'm using word 2003
thanks
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can just rename the files (a.rtf -> a.doc). Why?
ASKER
what i tried so far is in properties i changed the open with from word pad to word and it didnt work i'll try changing the extention i;ll let you know thanks
file - save as - word document .doc
or programatically
found here
http://www.wiredbox.de/Forum/Thread76961_RTF_to_DOC_conversion.aspx
save this as a vbs file
'' Start of Script
Option Explicit
On Error Resume Next
Dim Response
Dim anRTForDOCisOpen_Flag
dim nominatedFolder
dim fso
dim oApp
set oApp = createobject("Word.Applica tion")
Set fso = CreateObject("Scripting.Fi leSystemOb ject")
nominatedFolder =fso.GetAbsolutePathName ("convertRTF2DOC.vbs")
nominatedFolder = Left(nominatedFolder, _
Len(nominatedFolder)-19)
Response = MsgBox("Instruction:" & vbCrLf & _
"Place a copy of this program in any folder that" & _
" contains .rtf files that you want to convert to .doc files." _
& vbCrLf & _
"Please CLOSE all .rtf files to be converted to .doc files." _
& " And CLOSE all related .doc file with similar name as the .rtf. " _
& vbCrLf & "Double click on the program to start it and get this" & _
"initial window message prompt." & vbCrLf & vbCrLf & _
"Note:"&vbCrLf & _
"This program will completely replace the RTF files with DOC files." _
& vbCrLf & vbCrLf & "This program's current folder is " _
& nominatedFolder _
& vbCrLf & vbCrLf & vbCrLf & _
"Press OK button to continue with the conversion.", vbOKCancel, _
"RTF to DOC")
If Response <> 2 Then
ShowFolderList(nominatedFo lder) ' call procedure
End if
oApp.Quit
set oApp = nothing
Set fso = nothing
Set nominatedFolder = nothing
' End of Script
'**************sub procedure***************** **
'this sub procedure is copied from Peter Jamieson post
'Thanks for inspiring me to expand your original script
sub convertRTFtoDOC(pathWithRT Ffilename)
dim newpathFilename 'as string
dim oDoc 'as object
newpathFilename = pathWithRTFfilename
' the ,0 parameter means do not confirm conversions
set oDoc = oApp.Documents.Open(newpat hFilename, 0)
'remove .rtf and replace with .doc as the new filename
newpathFilename = Left(newpathFilename, _
Len(newpathFilename) - 4) & ".doc"
' the 0 parameter means use .doc format
oDoc.SaveAs newpathFilename, 0
oDoc.close ' Important to close the .doc file
End sub
'************sub procedure***************** ***
Sub ShowFolderList(folderspec)
Dim fs, f, f1, fc, s, i
i = 0
Set fs = CreateObject("Scripting.Fi leSystemOb ject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
'loop & capture RTF & send to another sub for conversion to DOC
For Each f1 in fc
verifyIfRTForDOCopen (f1.name)
if (anRTForDOCisOpen_Flag = true) then
exit sub
end if
if (f1.type = "Rich Text Format") then
convertRTFtoDOC f1
s = s & f1.name
s = s & vbCrLf 'visualbasicCarriageLineFe ed
f1.Delete True ' True force delete of read only file
i = i + 1 'count how many .rtf files
end if
Next
' release memory use by object - not needed anymore.
Set fs = nothing
Set f = nothing
Set fc = nothing
If s = "" then
MsgBox "No .rtf file have been found in the folder " & folderspec & _
vbCrLf & vbCrLf & "Press OK button to EXIT."
else
MsgBox s & vbCrLf & i & " .rtf file converted to .doc file."
end if
Set nominatedFolder = nothing
End Sub
'*********************sub procedure***************** ******
sub verifyIfRTForDOCopen (f1dotname)
Dim colTasks , objTask, strName1,strName2
Set colTasks = oApp.Tasks
anRTForDOCisOpen_Flag = false
For Each objTask in colTasks
strName1 = Lcase(objTask.Name)
strName2 = Lcase(Left(f1dotname,Len(f 1dotname) - 4))
If (Instr(strName1,strName2) >= 1) Then
MsgBox f1dotname & " is left open. Please close this file. " _
& vbCrLf & vbCrLf & _
"This program is halted!!! " & _
"Close all RTF and related DOC file before restarting program."_
, 0,"You have forgotten to close a file!!!"
anRTForDOCisOpen_Flag = true
exit sub
End If
Next
End sub
or programatically
found here
http://www.wiredbox.de/Forum/Thread76961_RTF_to_DOC_conversion.aspx
save this as a vbs file
'' Start of Script
Option Explicit
On Error Resume Next
Dim Response
Dim anRTForDOCisOpen_Flag
dim nominatedFolder
dim fso
dim oApp
set oApp = createobject("Word.Applica
Set fso = CreateObject("Scripting.Fi
nominatedFolder =fso.GetAbsolutePathName ("convertRTF2DOC.vbs")
nominatedFolder = Left(nominatedFolder, _
Len(nominatedFolder)-19)
Response = MsgBox("Instruction:" & vbCrLf & _
"Place a copy of this program in any folder that" & _
" contains .rtf files that you want to convert to .doc files." _
& vbCrLf & _
"Please CLOSE all .rtf files to be converted to .doc files." _
& " And CLOSE all related .doc file with similar name as the .rtf. " _
& vbCrLf & "Double click on the program to start it and get this" & _
"initial window message prompt." & vbCrLf & vbCrLf & _
"Note:"&vbCrLf & _
"This program will completely replace the RTF files with DOC files." _
& vbCrLf & vbCrLf & "This program's current folder is " _
& nominatedFolder _
& vbCrLf & vbCrLf & vbCrLf & _
"Press OK button to continue with the conversion.", vbOKCancel, _
"RTF to DOC")
If Response <> 2 Then
ShowFolderList(nominatedFo
End if
oApp.Quit
set oApp = nothing
Set fso = nothing
Set nominatedFolder = nothing
' End of Script
'**************sub procedure*****************
'this sub procedure is copied from Peter Jamieson post
'Thanks for inspiring me to expand your original script
sub convertRTFtoDOC(pathWithRT
dim newpathFilename 'as string
dim oDoc 'as object
newpathFilename = pathWithRTFfilename
' the ,0 parameter means do not confirm conversions
set oDoc = oApp.Documents.Open(newpat
'remove .rtf and replace with .doc as the new filename
newpathFilename = Left(newpathFilename, _
Len(newpathFilename) - 4) & ".doc"
' the 0 parameter means use .doc format
oDoc.SaveAs newpathFilename, 0
oDoc.close ' Important to close the .doc file
End sub
'************sub procedure*****************
Sub ShowFolderList(folderspec)
Dim fs, f, f1, fc, s, i
i = 0
Set fs = CreateObject("Scripting.Fi
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
'loop & capture RTF & send to another sub for conversion to DOC
For Each f1 in fc
verifyIfRTForDOCopen (f1.name)
if (anRTForDOCisOpen_Flag = true) then
exit sub
end if
if (f1.type = "Rich Text Format") then
convertRTFtoDOC f1
s = s & f1.name
s = s & vbCrLf 'visualbasicCarriageLineFe
f1.Delete True ' True force delete of read only file
i = i + 1 'count how many .rtf files
end if
Next
' release memory use by object - not needed anymore.
Set fs = nothing
Set f = nothing
Set fc = nothing
If s = "" then
MsgBox "No .rtf file have been found in the folder " & folderspec & _
vbCrLf & vbCrLf & "Press OK button to EXIT."
else
MsgBox s & vbCrLf & i & " .rtf file converted to .doc file."
end if
Set nominatedFolder = nothing
End Sub
'*********************sub procedure*****************
sub verifyIfRTForDOCopen (f1dotname)
Dim colTasks , objTask, strName1,strName2
Set colTasks = oApp.Tasks
anRTForDOCisOpen_Flag = false
For Each objTask in colTasks
strName1 = Lcase(objTask.Name)
strName2 = Lcase(Left(f1dotname,Len(f
If (Instr(strName1,strName2) >= 1) Then
MsgBox f1dotname & " is left open. Please close this file. " _
& vbCrLf & vbCrLf & _
"This program is halted!!! " & _
"Close all RTF and related DOC file before restarting program."_
, 0,"You have forgotten to close a file!!!"
anRTForDOCisOpen_Flag = true
exit sub
End If
Next
End sub
Hello ric55,
Just open the file in MS-Word and then save the file with other name as .doc.
I think this is pretty simple one.
And if you have more files then you have to rename the files using batch rename software to one go.
Hope this helps,
From
Karunamoorthy.
Just open the file in MS-Word and then save the file with other name as .doc.
I think this is pretty simple one.
And if you have more files then you have to rename the files using batch rename software to one go.
Hope this helps,
From
Karunamoorthy.
Forced accept.
Computer101
EE Admin
Computer101
EE Admin