1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
Sub Importation_Donnees_Word()
'- déclaration varaible
'- Boucle sur les fichier doc
'- etc puis
'**** Se positionner Sur le tableau précis ****
Set Rng = WDoc.Range 'Plage de recherche
Do
With Rng.Find
.ClearFormatting
.Text = "Produits techniques" ' Texte à rechercher (se trouvant avant la table)
.Execute
End With
If Rng.Find.Found Then
Rng.Select
Rng.MoveStart unit:=wdTable
Rng.Goto What:=wdGoToTable, Which:=wdGoToNext, Count:=1
'Selectionne le tableau trouvé pour extraire les données
Set WTable = Rng.Tables(1)
' Voila ou je veux faire le test avant l'extraction
'************ L'extraction des cellules ****************
For Each C In WTable.Range.Cells
If InStr(1, WorksheetFunction.Clean(C), "Système dexploitation") > 0 Then
j = C.Row.Index + 1
GoTo ContinueC
End If
Next C
ContinueC:
i = ii
Do
' Les cellules a extraire
ws.Cells(i, 2) = WorksheetFunction.Clean(WTable.Cell(j, 1).Range.Text)
ws.Cells(i, 3) = WorksheetFunction.Clean(WTable.Cell(j, 2).Range.Text)
j = j + 1
i = i + 1
Loop Until (InStr(1, WorksheetFunction.Clean(WTable.Cell(j, 1).Range.Text), "Base de données") > 0)
End If ' Pour le "Rng.Find.Found"
Loop Until Not Rng.Find.Found
Loop
End Sub |
Partager