Hello all,
I'm trying to adapt a script given here
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/
hey0401.mspx
to do a massive conversion from word to TeX using the file converter
word2tex
http://www.chikrii.com/products/word2tex/dl/
What I've done is the fellowing:
'Begin script
Const wdFormatDocument = 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='X:\annales'} Where " _
& "ResultClass = CIM_DataFile")
Set objWord = CreateObject("Word.Application")
Dim cnvTeX As FileConverter
For Each objFile in colFiles
If objFile.Extension = "doc" Then
strFile = "X:\annales\" & objFile.FileName & "." &
objFile.Extension
strNewFile = "X:\annales-TeX\" & objFile.FileName & ".tex"
Set objDoc = objWord.Documents.Open(strFile)
For Each cnvTeX In Application.FileConverters
If cnvTeX.ClassName = "TeX32exp" Then
objDoc.SaveAs strNewFile, _
FileFormat:=cnvTeX.SaveFormat
End If
Next cnvTeX
objDoc.Close
End If
Next
objWord.Quit
'End Script
where X:\annales is the directory where the .doc files are stored and X:
\annales-TeX is the diretory where I want the files converted to be
stored. TeX32exp is the ClassName for the FileConverter word2tex.
And guess what?... It does not work :-( I'm sorry but I'm not a vbs guru,
so if anyone could help, I would highly appreciate.
Thanks in advance
--
Christophe