- Dim word,doc,fso,fc,f
- Dim strBaseName,strExtName
-
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set fc = fso.GetFolder(".").Files
-
- Set word = CreateObject("Word.Application")
-
- For Each f In fc
- strExtName = LCase( fso.GetExtensionName(f.Path) )
-
- If strExtName="doc" Or strExtName="docx" Then
- strBaseName = fso.GetBaseName(f.Path)
- Set doc = word.Documents.Open(f.Path)
-
- doc.SaveAs fso.GetFolder(".") & "\" & strBaseName & ".txt",7
-
- doc.Close
-
- End If
- Next
-
- MsgBox "转换完成"
-
- Set fso = Nothing
- Set fc = Nothing
- Set f = Nothing
- Set word = Nothing
- Set doc = Nothing
复制代码
|