Re: DOC to TXT
- From: "Kyle.Zhang" <rookieport@xxxxxxx>
- Date: Thu, 4 Sep 2008 23:48:12 +0800
You can use FileSystemObject to browse files and folders in your specified folder, and use it to delete the document.
Dim doc As Word.Document
Dim fso, folder, subFolder, docFile
Dim sPath As String
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("E:\Training\docs")
For Each subFolder In folder.SubFolders
For Each docFile In subFolder.Files
If UCase(Right(docFile.Name, 4)) = ".DOC" Then
sPath = docFile.Path
Set doc = Documents.Open(sPath, , , False, , , , , , , , False)
sPath = docFile.Path & ".txt"
doc.SaveAs sPath, Word.wdFormatText
doc.Close False
docFile.Delete
End If
Next
Next
"Mike Berger" <mike_berger@xxxxxxxx> ???? news:#qDapNmBJHA.1628@xxxxxxxxxxxxxxxxxxxxxxx
Hello Newsgroup!.
I have a foldertree with 3 underfolders, that include about 500 .doc
documents.
I will open the .doc automatily and then saving as .txt and if possible
delete the .doc file from the disc.
I can open one file with VBA, when I have the filename in the code.
It's possible to make that with VBA?
Thank you.
Mike
- Prev by Date: Re: Looking for suggestions how to make my functional but ugly hack jo
- Next by Date: Re: Macro to work on picture
- Previous by thread: Re: Looking for suggestions how to make my functional but ugly hack jo
- Next by thread: Re: Macro to work on picture
- Index(es):
Relevant Pages
|