Bonjour,

Je travaille sur Word 2010 et j'aimerai savoir s'il existe une macro permettant de modifier le path de toutes les images liées dans un document.
Pour insérer des images je fais "Insérer > Images > Lier au fichier", chaque image a donc un chemin relatif. J'aimerai pouvoir modifier ce chemin d'un coup pour tous les fichiers.

J'utilisais une macro qui faisait ça sous Word 2003 mais avec 2010, elle plante.

Merci d'avance pour votre aide

Pour info, voici la macro que j'utilisais sous 2003:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Sub RelinkGraphics()
    On Error Resume Next
    If ActiveDocument.Path = "" Then
        MsgBox "Save your document in a folder of your choice, then try again.", , "Find graphics and copy them to folder where document is stored"
        Exit Sub
    End If
 
    For Each myShape In ActiveDocument.InlineShapes
        If myShape.LinkFormat.Type <> wdLinkTypePicture Then GoTo EndOfMyShape
        'If myShape.LinkFormat.SourcePath = ActiveDocument.Path Then GoTo EndOfMyShape
 
        MyFileWas = Dir(myShape.LinkFormat.SourceFullName)
        myfileisnow = "..\Pictures\" & myShape.LinkFormat.SourceName
 
        If myfileisnow <> "" Then
            myShape.LinkFormat.SourceFullName = myfileisnow
            myShape.LinkFormat.Update
        ElseIf MyFileWas <> "" Then
            FileCopy myShape.LinkFormat.SourceFullName, ActiveDocument.Path & Application.PathSeparator & myShape.LinkFormat.SourceName
            myShape.LinkFormat.SourceFullName = ActiveDocument.Path & Application.PathSeparator & myShape.LinkFormat.SourceName
            myShape.LinkFormat.Update
        Else
            MsgBox "Couldn't locate " & myShape.LinkFormat.SourceFullName
        End If
 
EndOfMyShape:
        ActiveDocument.UndoClear
    Next myShape
End Sub