We need to convert programmatically docx files into doc (xlsx into xls, pptx
into ppt) server side, on-the-fly. Is there some converter component
avalable? The target platform is windows (xp/2003/vista). The component
should be DLL/COM in order to be used from VB6 code.

Re: Programmatical conversion of docx into doc by Graham

Graham
Tue Dec 04 02:34:55 PST 2007

I cannot comment for Excel,and PP, but for Word the following should do the
trick.

Sub SaveAllAsDOC()
Dim strFileName As String
Dim strDocName As String
Dim strPath As String
Dim oDoc As Document

With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
strPath = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
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 & "*.docx")

While Len(strFileName) <> 0
Set oDoc = Documents.Open(strPath & strFileName)

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


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

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

Nataliya Yevdoshenko wrote:
> We need to convert programmatically docx files into doc (xlsx into
> xls, pptx into ppt) server side, on-the-fly. Is there some converter
> component avalable? The target platform is windows (xp/2003/vista).
> The component should be DLL/COM in order to be used from VB6 code.



Re: Programmatical conversion of docx into doc by NataliyaYevdoshenko

NataliyaYevdoshenko
Tue Dec 04 04:22:02 PST 2007

Thank you! this helped!

"Graham Mayor" wrote:

> I cannot comment for Excel,and PP, but for Word the following should do the
> trick.
>
> Sub SaveAllAsDOC()
> Dim strFileName As String
> Dim strDocName As String
> Dim strPath As String
> Dim oDoc As Document
>
> With Dialogs(wdDialogCopyFile)
> If .Display <> 0 Then
> strPath = .Directory
> Else
> MsgBox "Cancelled by User"
> Exit Sub
> End If
> 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 & "*.docx")
>
> While Len(strFileName) <> 0
> Set oDoc = Documents.Open(strPath & strFileName)
>
> strDocName = ActiveDocument.FullName
> intPos = InStrRev(strDocName, ".")
> strDocName = Left(strDocName, intPos - 1)
> strDocName = strDocName & ".doc"
> oDoc.SaveAs FileName:=strDocName, _
> FileFormat:=wdFormatDocument
> oDoc.Close SaveChanges:=wdDoNotSaveChanges
> strFileName = Dir$()
> Wend
> End Sub
>
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> Nataliya Yevdoshenko wrote:
> > We need to convert programmatically docx files into doc (xlsx into
> > xls, pptx into ppt) server side, on-the-fly. Is there some converter
> > component avalable? The target platform is windows (xp/2003/vista).
> > The component should be DLL/COM in order to be used from VB6 code.
>
>
>