Microsoft KB Archive/242875

= How to Use WinWord to Convert RTF Files to Windows DOC Files =

Article ID: 242875

Article Last Modified on 6/23/2005

-

APPLIES TO


 * Microsoft Index Server 2.0
 * Microsoft Site Server 3.0 Standard Edition

-



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 INFORMATION
Microsoft 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.

Keywords: kbprb KB242875

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.