How to Use WinWord to Convert RTF Files to Windows DOC Files (242875)
The information in this article applies to:
- Microsoft Index Server 2.0
- Microsoft Site Server 3.0
This article was previously published under Q242875 SYMPTOMS
Microsoft Office documents are not indexed.
CAUSE
The Microsoft Office filter used by Microsoft Site Server Search and Microsoft Index Server only supports indexing HTML, plain text, and Microsoft Office documents (.doc, .dot, .ppt, .pot, .xlb, .xls, .xlc, .obd, .opt). Rich Text Format (RTF) files are not supported by the Microsoft Office filter because there are too many different RTF formats.
RESOLUTION
A Microsoft Word macro can be written to automatically convert the files to the Word for Windows DOC format. A sample is provided below. Modify as needed.
Sub convert()
Dim strFile As String
Dim X As String
Dim Y As String
Dim Z As Object
'Collect Drive and directory to convert Word Docs in.
X = InputBox("Please enter the drive the documents are on.", "Drive Letter", "C")
Y = InputBox("Please enter the path to the directory the files are in.", "Path to files", "My Documents")
'seed the string to the first file in the directory
strFile = Dir(X & ":\" & (Y) & "\" & "*.rtf")
' Start looping through files opening and saving as current version of Word.
On Error Resume Next
Do While strFile <> ""
Documents.Open X & ":\" & (Y) & "\" & strFile, Format:=wdOpenFormatRTF
ActiveDocument.SaveAs (X & ":\" & Y & "\" & strFile), FileFormat = wdFormatDocument
ActiveDocument.Close
strFile = Dir
Loop
'Alert user operation is complete
MsgBox "done"
End Sub
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
Modification Type: | Major | Last Reviewed: | 6/23/2005 |
---|
Keywords: | kbprb KB242875 |
---|
|