Recherche de mot

Résolu/Fermé
simba_2015 Messages postés 10 Date d'inscription mardi 4 août 2015 Statut Membre Dernière intervention 18 août 2015 - 4 août 2015 à 10:43
simba_2015 Messages postés 10 Date d'inscription mardi 4 août 2015 Statut Membre Dernière intervention 18 août 2015 - 11 août 2015 à 14:16
bonjour,
Je suis actuellement responsable d'un contrat. Pour la gestion des défauts, mon client m'envoi un mail avec en pièce jointe un fichier Word qui contient les informations nécessaires à la réalisation du travail.
J'utilise un fichier excel pour le suivie de mes activités et la facturation.

Je souhaiterais que mon fichier excel recherche les information dont j'ai besoin dans le fichier Word et se complète automatiquement (tel que : nom du client, type de travail, description du travail, bâtiment, numéro de défauts, ...)

Le fichier Word qui m'est envoyé est toujours de forme identique avec ces même mots clefs.

Mon projet est t'il réalisable ?

Merci

6 réponses

tyranausor Messages postés 3545 Date d'inscription jeudi 6 août 2009 Statut Membre Dernière intervention 1 avril 2022 2 031
6 août 2015 à 12:42
Bonjour, cela peut être possible. As-tu un exemple-type?
0
simba_2015 Messages postés 10 Date d'inscription mardi 4 août 2015 Statut Membre Dernière intervention 18 août 2015
Modifié par simba_2015 le 6/08/2015 à 13:01
le fichier Word que je reçois est de ce type :



et le fichier Excel serait comme cela :

0
JvDo Messages postés 1978 Date d'inscription mercredi 27 juillet 2005 Statut Membre Dernière intervention 28 septembre 2020 856
6 août 2015 à 13:26
Bonjour,

une image ne fournit pas les indications de structure du document word (signets, tableaux).
envoie plutôt le fichier.

cdlt
0
simba_2015 Messages postés 10 Date d'inscription mardi 4 août 2015 Statut Membre Dernière intervention 18 août 2015 > JvDo Messages postés 1978 Date d'inscription mercredi 27 juillet 2005 Statut Membre Dernière intervention 28 septembre 2020
6 août 2015 à 13:33
On ne peut pas déposer de fichier sur CCM ?
0
JvDo Messages postés 1978 Date d'inscription mercredi 27 juillet 2005 Statut Membre Dernière intervention 28 septembre 2020 856
6 août 2015 à 13:36
tu peux passer par cjoint.com et tu colles dans ton prochain message le lien qu'ils t'auront calculé.

cdlt
0
simba_2015 Messages postés 10 Date d'inscription mardi 4 août 2015 Statut Membre Dernière intervention 18 août 2015
Modifié par simba_2015 le 6/08/2015 à 13:39
https://www.cjoint.com/c/EHglLdJoTHE
pour le fichier Word
et excel est basique "pour l'instant"

merci
0
tyranausor Messages postés 3545 Date d'inscription jeudi 6 août 2009 Statut Membre Dernière intervention 1 avril 2022 2 031
6 août 2015 à 17:04
Je viens de découvrir ton fichier, et il est sous forme de tableau, donc tu peux faire comme sous Excel, c'est-à-dire que la première case (ligne 1, colonne 1 = A1).

Le code doit jongler entre Excel et Word.
0
JvDo Messages postés 1978 Date d'inscription mercredi 27 juillet 2005 Statut Membre Dernière intervention 28 septembre 2020 856
6 août 2015 à 17:22
Bonjour,

Voici un code avec 2 solutions :
la première est un copier coller du tableau de word vers excel
la seconde est une recopie cellule par cellule.
Sub récup_word_fault_2()

    Dim wdapp As Word.Application
    Dim wdoc As Word.Document
    Dim objtable As Word.Table
    Dim nomfich As String
    
    nomfich = "E:\Users\jvdo\forum\ccm_Fault.doc"
     
    Set wdapp = CreateObject("Word.Application") 'creation session Word
    wdapp.Visible = True
    On Error Resume Next

    wdapp.Documents.Open Filename:=nomfich
    Set wdoc = wdapp.activeDocument
    Set objtable = wdoc.tables(1)

'1ère méthode : copier/coller du tableau
    objtable.Range.Copy
    ActiveSheet.Range("B20").Select
    ActiveSheet.Paste

'2ème méthode : remplissage cellule par cellule
    With ActiveSheet
        .Cells(2, 2) = WorksheetFunction.Substitute(objtable.Cell(1, 1).Range.Text, Chr(7), "")
        .Cells(2, 3) = WorksheetFunction.Substitute(objtable.Cell(1, 2).Range.Text, Chr(7), "")
        .Cells(3, 2) = WorksheetFunction.Substitute(objtable.Cell(1, 4).Range.Text, Chr(7), "")
        .Cells(3, 3) = WorksheetFunction.Substitute(objtable.Cell(1, 5).Range.Text, Chr(7), "")
        .Cells(4, 2) = WorksheetFunction.Substitute(objtable.Cell(1, 6).Range.Text, Chr(7), "")
        .Cells(4, 3) = WorksheetFunction.Substitute(objtable.Cell(1, 7).Range.Text, Chr(7), "")
        .Cells(5, 2) = WorksheetFunction.Substitute(objtable.Cell(3, 1).Range.Text, Chr(7), "")
        .Cells(5, 3) = WorksheetFunction.Substitute(objtable.Cell(3, 2).Range.Text, Chr(7), "")
        .Cells(6, 2) = WorksheetFunction.Substitute(objtable.Cell(5, 1).Range.Text, Chr(7), "")
        .Cells(6, 3) = WorksheetFunction.Substitute(objtable.Cell(5, 2).Range.Text, Chr(7), "")
        .Cells(7, 2) = WorksheetFunction.Substitute(objtable.Cell(5, 4).Range.Text, Chr(7), "")
        .Cells(7, 3) = WorksheetFunction.Substitute(objtable.Cell(5, 5).Range.Text, Chr(7), "")
        .Cells(8, 2) = WorksheetFunction.Substitute(objtable.Cell(7, 1).Range.Text, Chr(7), "")
        .Cells(8, 3) = WorksheetFunction.Substitute(objtable.Cell(7, 2).Range.Text, Chr(7), "")
        .Cells(9, 2) = WorksheetFunction.Substitute(objtable.Cell(7, 4).Range.Text, Chr(7), "")
        .Cells(9, 3) = WorksheetFunction.Substitute(objtable.Cell(7, 5).Range.Text, Chr(7), "")
        .Cells(10, 2) = WorksheetFunction.Substitute(objtable.Cell(9, 1).Range.Text, Chr(7), "")
        .Cells(10, 3) = WorksheetFunction.Substitute(objtable.Cell(9, 2).Range.Text, Chr(7), "")
        .Cells(11, 2) = WorksheetFunction.Substitute(objtable.Cell(9, 4).Range.Text, Chr(7), "")
        .Cells(11, 3) = WorksheetFunction.Substitute(objtable.Cell(9, 6).Range.Text, Chr(7), "")
        .Cells(12, 2) = WorksheetFunction.Substitute(objtable.Cell(11, 1).Range.Text, Chr(7), "")
        .Cells(12, 3) = WorksheetFunction.Substitute(objtable.Cell(11, 2).Range.Text, Chr(7), "")
        .Cells(13, 2) = WorksheetFunction.Substitute(objtable.Cell(11, 4).Range.Text, Chr(7), "")
        .Cells(13, 3) = WorksheetFunction.Substitute(objtable.Cell(11, 5).Range.Text, Chr(7), "")
        .Cells(14, 2) = WorksheetFunction.Substitute(objtable.Cell(13, 1).Range.Text, Chr(7), "")
        .Cells(14, 3) = WorksheetFunction.Substitute(objtable.Cell(14, 1).Range.Text, Chr(7), "")
        .Cells(15, 2) = WorksheetFunction.Substitute(objtable.Cell(16, 1).Range.Text, Chr(7), "")
        .Cells(15, 3) = WorksheetFunction.Substitute(objtable.Cell(16, 2).Range.Text, Chr(7), "")
        .Cells(16, 2) = WorksheetFunction.Substitute(objtable.Cell(17, 1).Range.Text, Chr(7), "")
        .Cells(16, 3) = WorksheetFunction.Substitute(objtable.Cell(17, 2).Range.Text, Chr(7), "")
        
    End With
    wddoc.Close False
    wdapp.Quit

End Sub


J'ai laissé word visible pour le débogage et tu dois modifier le chemin de ton fichier.

cordialement
0
simba_2015 Messages postés 10 Date d'inscription mardi 4 août 2015 Statut Membre Dernière intervention 18 août 2015
7 août 2015 à 13:48
merci c'est exactement ce que je voulais faire !
Mais, car il y a un mais... le nom du fichier que je reçois n'est jamais le même et en temps normal je ne l'enregistre pas, il est dans ma boite mail, je l'ouvre et le recopie manuellement
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
tyranausor Messages postés 3545 Date d'inscription jeudi 6 août 2009 Statut Membre Dernière intervention 1 avril 2022 2 031
7 août 2015 à 21:46
Bonjour, quand tu ouvre un fichier se trouvant dans ta boîte mail, il s'enregistre, en arrière-plan, dans le dossier temp se trouvant généralement dans C:\Users\ton nom\Local\Temp (le chemin varie suivant la version de Windows).

Il te suffiras de changer le chemin du fichier dans le code proposé par JvDo
0
simba_2015 Messages postés 10 Date d'inscription mardi 4 août 2015 Statut Membre Dernière intervention 18 août 2015
11 août 2015 à 14:16
Merci beaucoup pour vos réponse, j'ai réussi à obtenir le résultat souhaité. Le fichier et fini mais j'ai encore deux petit soucie à régler... j'ai créé une nouvelle discutions pour ne pas polluer celle ci (https://forums.commentcamarche.net/forum/affich-32376857-diminution-de-codes si vous pouviez encore m'aider je vous en serais reconnaissant.
il faut s'armer de courage si vous vous lancez dans mes questions suivantes...
0