• Change IncludePicture Path folder paths (MS Word 2003, SP3)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Change IncludePicture Path folder paths (MS Word 2003, SP3)

    Author
    Topic
    #452793

    Hello,
    I think this was posted in the past.
    If so, then can someone provide me with the forum posting?

    I am looking for a complete macro that will allow me to point to a folder full of word documents.
    Next, the macro will change the folder path structure of all graphics linked to file (includepicture)
    from S:GraphicsCatalog A to S:GraphicsCatalog .

    Once again, if someone has a complete example, where I just need to change the folder path structure,
    that would be terrific.

    Thanks,

    -J

    Viewing 1 reply thread
    Author
    Replies
    • #1118836

      Take a look at the threads beginning at post 705,537 and post 703,133.

      • #1118838

        Hello Hans,

        I was looking at each post, but not sure exactly where you wanted me to direct my attention.
        I did find this macro and I was wondering if you could tell me if I have the folder structure (e.g. S:GraphicsCatalog A to S:GraphicsCatalog setup correctly.

        Thanks,

        Jim

        Here’s the macro with the old code (not to be used) at the very bottom:

        Sub ReplaceInFolder()
        ‘ Modify as needed, but keep the trailing backslash
        Const strFolder = “C:Temp1”
        Dim strFile As String
        Dim doc As Document
        Application.ScreenUpdating = False
        strFile = Dir(strFolder & “*.doc”)
        Do While Not strFile = “”
        Set doc = Documents.Open(strFolder & strFile)
        ReplaceInDoc doc
        doc.Close SaveChanges:=True
        strFile = Dir
        Loop
        Application.ScreenUpdating = True
        End Sub

        Sub ReplaceInDoc(doc As Document)
        ActiveWindow.View.ShowFieldCodes = True
        doc.Content.Find.Execute FindText:=”C:GraphicsCatalog A”, ReplaceWith:=”C:GraphicsCatalog B “, Replace:=wdReplaceAll
        doc.Fields.Update
        ActiveWindow.View.ShowFieldCodes = False
        End Sub

        Sub ReplaceInDoc(doc As Document)
        ActiveWindow.View.ShowFieldCodes = True
        With doc.Content.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .MatchWildcards = True
        .Execute FindText:=”(Figure*AUTONUMLGL*[!.])(^13)”, _
        ReplaceWith:=”1.2″, Replace:=wdReplaceAll
        .Execute FindText:=”(Figure*SEQ Figure*[!.])(^13)”, _
        ReplaceWith:=”1.2″, Replace:=wdReplaceAll
        End With
        ActiveWindow.View.ShowFieldCodes = False
        End Sub

        • #1118841

          That looks OK, except for the space after B within the quotes: I think

          doc.Content.Find.Execute FindText:="C:GraphicsCatalog A", ReplaceWith:="C:GraphicsCatalog B ", Replace:=wdReplaceAll

          should be

          doc.Content.Find.Execute FindText:="C:GraphicsCatalog A", ReplaceWith:="C:GraphicsCatalog B", Replace:=wdReplaceAll

          Windows is *very* particular about such details.

    • #1118891

      Hi James,

      Take a look at my Field Link Updater in post 261488 and the methods for implementing relative paths in Word, in post 670027:

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

      • #1118957

        Hello Paul,

        Thanks for the reply.
        I will take a long look at your solution.

        Cheers!

        Jim

    Viewing 1 reply thread
    Reply To: Change IncludePicture Path folder paths (MS Word 2003, SP3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: