vbs : wps 另存为 xml,html

wps_SaveAs.vbs

If WScript.Arguments.Count > 0 Then
  Filename = WScript.Arguments(0)
Else
  WScript.Echo " 用法: wps_saveas.vbs filename.wps "
  WScript.Quit
End If

Set wps = CreateObject("Kwps.Application")
wps.Visible = True
wps.Documents.Open Filename
fn = Replace(Replace(Filename, ".wps", ""), ".doc", "") 
'wps.ActiveDocument.SaveAs fn & ".html", 10
wps.ActiveDocument.SaveAs fn & ".xml", 11
wps.Quit()

Set wps = Nothing

注意: 文件名一定要用绝对路径

word_SaveAs.vbs

If WScript.Arguments.Count > 0 Then
  Filename = WScript.Arguments(0)
Else
  WScript.Echo " 用法: word_saveas.vbs filename.word "
  WScript.Quit
End If

Set word = CreateObject("Word.Application")
word.Visible = True
word.Documents.Open Filename
fn = Replace(Replace(Filename, ".doc", ""), ".DOC", "") 
'word.ActiveDocument.SaveAs fn & ".html", 10
word.ActiveDocument.SaveAs fn & ".xml", 11
word.Quit()

Set word = Nothing

 

你可能感兴趣的:(Windows,wps,saveas,xml)