sjac
Sat Jun 26 05:57:47 CDT 2004
Copy the below macro code into your normal.dot template and try it.
Sub Report()
With Application.FileSearch
.NewSearch
.FileType = msoFileTypeAllFiles
.LookIn = "d:\data" 'Path to the folder having the documents
.Execute
TotalFiles = .FoundFiles.Count
For i = 1 To TotalFiles
Documents.Open .FoundFiles(i)
myname = .FoundFiles(i)
X = ActiveDocument.Name
pos = InStrRev(myname, ".doc")
s = Left(myname, pos - 1)
ActiveDocument.SaveAs Filename:=s & ".txt",
FileFormat:=wdFormatText, _
LockComments:=False, Password:="", AddToRecentFiles:=True,
WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False,
_
SaveNativePictureFormat:=False, SaveFormsData:=False,
SaveAsAOCELetter:= _
False
ActiveWindow.Close
Next i
End With
End Sub
HTH,
Stephen
http://crosssoft.netfirms.com
"Kas" <anonymous@discussions.microsoft.com> wrote in message news:<2111701c45a21$3e18a680$a101280a@phx.gbl>...
> I need code to open each document in a specific directory
> and save them as text files. Any help on this would be
> greatly appreciated.