Windows平台使用技巧_doc和docx转txt
2017-01-20 17:46
393 查看
Windows平台使用技巧_doc和docx转txt
方法出自此网址步骤
新建一个word文件,打开创建宏:点开视图;宏;录制宏;停止录制
替换宏:点开视图;宏;查看宏;选中刚才新建的宏;编辑;用以下代码替换自动生成的代码,F5运行,选择多个文件,点击确定,转后的text在同级目录下。
代码:
Sub Doc2txt() Dim myDialog As FileDialog Dim oFile As Variant Dim oDoc As Document Set myDialog = Application.FileDialog(msoFileDialogFilePicker) With myDialog .Filters.Clear .Filters.Add "WORD 97-03 文档", "*.doc", 1 .AllowMultiSelect = True If .Show <> -1 Then Exit Sub Application.ScreenUpdating = False For Each oFile In .SelectedItems Set oDoc = Word.Documents.Open(FileName:=oFile, Visible:=False) oDoc.SaveAs FileName:=Left(oFile, Len(oFile) - 3) & "txt", FileFormat:=wdFormatText oDoc.Close Next Application.ScreenUpdating = True End With End Sub Sub Docx2txt() Dim myDialog As FileDialog Dim oFile As Variant Dim oDoc As Document Set myDialog = Application.FileDialog(msoFileDialogFilePicker) With myDialog .Filters.Clear .Filters.Add "WORD 文档", "*.docx", 1 .AllowMultiSelect = True If .Show <> -1 Then Exit Sub Application.ScreenUpdating = False For Each oFile In .SelectedItems Set oDoc = Word.Documents.Open(FileName:=oFile, Visible:=False) oDoc.SaveAs FileName:=Left(oFile, Len(oFile) - 4) & "txt", FileFormat:=wdFormatText oDoc.Close Next Application.ScreenUpdating = True End With End Sub
相关文章推荐
- 一些软件在windows平台上的使用技巧
- 使用Lucene对doc、docx、pdf、txt文档进行全文检索功能的实现
- 一些软件在windows平台上的使用技巧
- 使用php+xslt在windows平台上
- windows下使用makefile编译C语言.doc
- WIndows平台下使用CTex
- VSTS 编写测试Test技巧:如何使用Deployment Items在测试类中引用文件,和普通Windows项目不一样哦。
- Windows 2003使用技巧荟萃
- 在Windows平台使用Apache2.2和Mongrel运行Ruby on Rails
- 使用php+xslt在windows平台上
- Windows ListCtrl使用技巧
- Windows使用若干技巧
- Windows XP Pro 使用技巧
- Windows ListCtrl使用技巧
- Windows ListCtrl使用技巧(转)
- (转载)使用Windows的140个技巧(二)
- System.windows.forms.datagrid控件使用技巧
- Windows常用网络命令(五)Tracert、Route 与 NBTStat的使用技巧
- Windows 2003实用使用技巧七则