Hello all,

In a Scripting Guy's script, I found the fellowing

http://www.microsoft.com/technet/scriptcenter/resources/qanda/dec04/
hey1222.mspx

'
Const wdFormatText = 2

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("c:\scripts\mylog.doc")
objDoc.SaveAs "c:\scripts\mylog.txt", wdFormatText

objWord.Quit
'

My question is: Where can I find the documentation regarding the
constants the SaveAs method expects (the value of wdFormatText)?

Note: What I'm trying to do is to script the conversion of a lot of files
from word to LaTeX using word2tex

http://www.chikrii.com/products/word2tex/dl/

but I don't know what numerical constant that corresponds to the .tex
format. I will use for this an other Scripting Guy's script

http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/
hey0401.mspx

Thanks in advance

--
Christophe

Re: Constants corresponding to DocumentFormat for SaveAs by Klaus

Klaus
Sun Jun 29 05:40:16 PDT 2008

Hi Cristophe,

There's no constant for TeX ...

You can see all the constants in the object browser.
Type the one you've got (wdFormatText) into the search field (with the
binoculars), and you'll see that it belongs to the enumeration wdSaveFormat.
There are only constants/elements for the internal comnverters.

For what you want to do, I think you'll have to look at the external
converters you have installed.
The VBA help for "SaveAs" may help. It has some sample code for the external
WP converters ... see Sub SaveWithConverter()

Sub SaveWithConverter()

Dim cnvWrdPrf As FileConverter

'Look for WordPerfect file converter
'And save document using the converter
'For the FileFormat converter value
For Each cnvWrdPrf In Application.FileConverters
If cnvWrdPrf.ClassName = "WrdPrfctWin" Then
ActiveDocument.SaveAs FileName:="MyWP.doc", _
FileFormat:=cnvWrdPrf.SaveFormat
End If
Next cnvWrdPrf

End Sub

You'd probably first have to iterate through all file converters and find
out the .ClassName for the Word2TeX converter (or find it from its
documentation).

Regards,
Klaus



"Christophe Jorssen" wrote:
> Hello all,
>
> In a Scripting Guy's script, I found the fellowing
>
> http://www.microsoft.com/technet/scriptcenter/resources/qanda/dec04/
> hey1222.mspx
>
> '
> Const wdFormatText = 2
>
> Set objWord = CreateObject("Word.Application")
> Set objDoc = objWord.Documents.Open("c:\scripts\mylog.doc")
> objDoc.SaveAs "c:\scripts\mylog.txt", wdFormatText
>
> objWord.Quit
> '
>
> My question is: Where can I find the documentation regarding the
> constants the SaveAs method expects (the value of wdFormatText)?
>
> Note: What I'm trying to do is to script the conversion of a lot of files
> from word to LaTeX using word2tex
>
> http://www.chikrii.com/products/word2tex/dl/
>
> but I don't know what numerical constant that corresponds to the .tex
> format. I will use for this an other Scripting Guy's script
>
> http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/
> hey0401.mspx
>
> Thanks in advance
>
> --
> Christophe


Re: Constants corresponding to DocumentFormat for SaveAs by Christophe

Christophe
Sun Jun 29 06:30:03 PDT 2008

Le Sun, 29 Jun 2008 14:40:16 +0200, Klaus Linke a écrit/wrote :

> Hi Cristophe,
>
> The VBA help for "SaveAs" may help. It has some sample code for the
> external WP converters ... see Sub SaveWithConverter()
>
> Sub SaveWithConverter()
>
> Dim cnvWrdPrf As FileConverter
>
> 'Look for WordPerfect file converter
> 'And save document using the converter 'For the FileFormat converter
> value
> For Each cnvWrdPrf In Application.FileConverters
> If cnvWrdPrf.ClassName = "WrdPrfctWin" Then
> ActiveDocument.SaveAs FileName:="MyWP.doc", _
> FileFormat:=cnvWrdPrf.SaveFormat
> End If
> Next cnvWrdPrf
>
> End Sub
>
> You'd probably first have to iterate through all file converters and
> find out the .ClassName for the Word2TeX converter (or find it from its
> documentation).

Great idea. Thanks a lot, I'll do this as soon as I get a windows box!

Best regards

--
Christophe

Re: Constants corresponding to DocumentFormat for SaveAs by Christophe

Christophe
Tue Jul 01 13:25:56 PDT 2008

Le Sun, 29 Jun 2008 14:40:16 +0200, Klaus Linke a écrit/wrote :
> You'd probably first have to iterate through all file converters and
> find out the .ClassName for the Word2TeX converter (or find it from its
> documentation).

Here is what I did. For Word2TeX it gives the fellowing results

ClassName = TeX32exp
FormatName = TeX

Sub List()
Dim fcLoop As FileConverter

For Each fcLoop In FileConverters
MsgBox "ClassName= " & fcLoop.ClassName & vbCr _
& "FormatName= " & fcLoop.FormatName
Next fcLoop
End Sub

--
Christophe