Conversion .docx to .doc (automation)
Bonjour,
j'essaie de convertir un .docx en .doc (.docx -> .rtf -> .doc) en utilisant l'automation avec wordcnv.dll mais cela ne fonctionne pas :( Qui peut me dire où est mon erreur ?
Code:
1 2 3
| Declare Function foreignToRtf Lib "wordcnv.dll" Alias "ForeignToRtf" (ghszFile As IntPtr, ByRef pstgForeign As Object, ghBuff As IntPtr, ghszClass As IntPtr, ghszSubset As IntPtr, lpfnOut As Long) As Long
'
Declare Function rtfToForeign Lib "wordcnv.dll" Alias "RtfToForeign" (ghszFile As IntPtr, ByRef pstgForeign As Object, ghBuff As IntPtr, ghszClass As IntPtr, ghszSubset As IntPtr, lpfnOut As Long) As Long |
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| 'Convert .docx to .doc
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add("C:\Utilisateurs\lculot\Documents\Exemple.docx")
oDoc.foreignToRtf()
oDoc.rtfToForeign()
Catch ex As Exception
MessageBox.Show("Impossible de convertir le document")
End Try
End Sub |