W2003, batch converter wizard - can it be ran from the command lin

A

A1sysman

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
 
G

Graham Mayor

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top