View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default W2003, batch converter wizard - can it be ran from the command lin

The following Word macro will do much the same

Sub SaveAllAsXML()
Dim strFilename As String
Dim strDocName As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , "List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" Then strPath = strPath + "\"
End With

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.doc")

While Len(strFilename) 0
Set oDoc = Documents.Open(strPath & strFilename)

strDocName = ActiveDocument.FullName
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
strDocName = strDocName & ".xml"
oDoc.SaveAs FileName:=strDocName, _
FileFormat:=wdFormatXML
oDoc.Close SaveChanges:=wdDoNotSaveChanges
strFilename = Dir$()
Wend
End Sub

http://www.gmayor.com/installing_macro.htm


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"A1sysman" wrote in message
...
Hi,

Working with Word 2003. I have installed the batch converter wizard and
all
is well.

I would like to create a batch file that opens Word, calls the wizard and
runs with a defined configuration, eg convert Word doc to xml, predefined
source and target folders, select all.

I can run a batch file to open the wizard, thus..

echo off
"C:\Program Files\Microsoft Office\Templates\1033\Batch Conversion
Wizard.Wiz"

... but I am still faced with manually selecting conversion type, sourc e
and target folders, select all.

I tried recording a macro calling the wizard and defining the settings -
no
luck, all the macro contained was a call to the wizard.

Any ideas please?

Thanks

N