A voir également:
- Word / Excel OLE ?
- Supprimer une page word - Guide
- Liste déroulante excel - Guide
- Word excel gratuit - Guide
- Espace insécable word - Guide
- Organigramme word - Guide
2 réponses
j'en suis a ce niveau .... si qqn peut m'aider ...
Sub test()
Dim Myfles As Variant
Dim OLE As OLE_OPTEXCLUSIVE
Dim appword As Word.Application, wbXL As Excel.Workbook
Dim docword As Word.Document
Dim Ow As Object
Set docword = New Word.Document
'Word.Documents.Open = True
'Word.Documents.Visible = True
myfiles = Array("G:\Test\REfffff.doc")
For i = 0 To UBound(myfiles)
If Dir(myfiles(i)) = Empty Then
MsgBox "Dossier vide"
Exit Sub
End If
Set doc = Ow.documentsOpen(Filename:=myfiles(i))
derligne = docword.Tables(1).Rows.Count
contrat_type = Cells(derligne, 1).Select
Selection.Copy
contrat_proc = Cells(derligne, 2).Value
ThisWorkbook.Worksheets("Fueil1").Paste
appword.Application.Quit
Application.CutCopyMode = False
Next i
Set doc = Nothing
Set Ow = Nothing
End Sub
Sub test()
Dim Myfles As Variant
Dim OLE As OLE_OPTEXCLUSIVE
Dim appword As Word.Application, wbXL As Excel.Workbook
Dim docword As Word.Document
Dim Ow As Object
Set docword = New Word.Document
'Word.Documents.Open = True
'Word.Documents.Visible = True
myfiles = Array("G:\Test\REfffff.doc")
For i = 0 To UBound(myfiles)
If Dir(myfiles(i)) = Empty Then
MsgBox "Dossier vide"
Exit Sub
End If
Set doc = Ow.documentsOpen(Filename:=myfiles(i))
derligne = docword.Tables(1).Rows.Count
contrat_type = Cells(derligne, 1).Select
Selection.Copy
contrat_proc = Cells(derligne, 2).Value
ThisWorkbook.Worksheets("Fueil1").Paste
appword.Application.Quit
Application.CutCopyMode = False
Next i
Set doc = Nothing
Set Ow = Nothing
End Sub