操作word可以使用宏和自定义VBA
还可以使用vbs--如下是doc转docx
Dim FSO,s
Set FSO=CreateObject("Scripting.FileSystemObject")
Set AllF=FSO.GetFolder(fso.GetParentFolderName (WScript.ScriptFullName ))
For Each file In AllF.Files
if right(file,3)="doc" then zhuanhuan file
Next
sub zhuanhuan(filename)
name=fso.getbasename(filename)
Set objWord = CreateObject("Word.Application")
'objWord.Visible = True
Const wdFormatText = 16 'xp 13 and ^xp 16
filePath = AllF & "\" & name & ".doc"
Set objDoc = objWord.Documents.Open(filePath)
objword.ActiveDocument.SaveAs AllF & "\" & name & ".docx",wdFormatText
objword.quit
end sub
注意:xp下wdFormatText 值要用13
参考资料:
http://www.ynpxrz.com/n1468421c2025.aspx
https://zhidao.baidu.com/question/455784518048589605.html --txt转doc
http://www.360doc.com/content/12/0114/12/8311608_179329398.shtml vbs错误处理
http://blog.csdn.net/wfq_1985/article/details/7097803 vbs传参数
http://blog.csdn.net/wfq_1985/article/details/7097803 vbs传参数