Skip to content

Instantly share code, notes, and snippets.

@Mart-Bogdan
Last active August 29, 2015 14:15
Show Gist options
  • Save Mart-Bogdan/23b7eb9d49a930e95b97 to your computer and use it in GitHub Desktop.
Save Mart-Bogdan/23b7eb9d49a930e95b97 to your computer and use it in GitHub Desktop.
docx2doc.vbs
rem enum WdSaveFormat
const wdFormatDocument = 0 rem <-- DOC
const wdFormatDocument97 = 0
const wdFormatTemplate = 1
const wdFormatTemplate97 = 1
const wdFormatText = 2
const wdFormatTextLineBreaks = 3
const wdFormatDOSText = 4
const wdFormatDOSTextLineBreaks = 5
const wdFormatRTF = 6
const wdFormatUnicodeText = 7
const wdFormatEncodedText = 7
const wdFormatHTML = 8
const wdFormatWebArchive = 9
const wdFormatFilteredHTML = 10
const wdFormatXML = 11
const wdFormatXMLDocument = 12 rem <-- DOCX
const wdFormatXMLDocumentMacroEnabled = 13
const wdFormatXMLTemplate = 14
const wdFormatXMLTemplateMacroEnabled = 15
const wdFormatDocumentDefault = 16
const wdFormatPDF = 17
const wdFormatXPS = 18
const wdFormatFlatXML = 19
const wdFormatFlatXMLMacroEnabled = 20
const wdFormatFlatXMLTemplate = 21
const wdFormatFlatXMLTemplateMacroEnabled = 22
Set objArgs = WScript.Arguments
Set objArgs = WScript.Arguments
Set objWord = CreateObject("Word.application")
For I = 0 to objArgs.Count - 1
FullName = objArgs(I)
FileName = Left(objArgs(I), InstrRev(objArgs(I), ".") )
set objWordBook = objWord.documents.Open(FullName)
objWord.application.visible=false
objWord.application.displayalerts=false
objWordBook.SaveAs FileName & "doc", wdFormatDocument97
objWordbook.close
set objWordBook = Nothing
Next
objWord.Quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment