Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts

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

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

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

    Take a look at the threads beginning at <post:=705,537>post 705,537</post:> and <post:=703,133>post 703,133</post:>.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts

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

    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

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

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

    That looks OK, except for the space after B within the quotes: I think
    <code>
    doc.Content.Find.Execute FindText:="C:GraphicsCatalog A", ReplaceWith:="C:GraphicsCatalog B ", Replace:=wdReplaceAll
    </code>
    should be
    <code>
    doc.Content.Find.Execute FindText:="C:GraphicsCatalog A", ReplaceWith:="C:GraphicsCatalog B", Replace:=wdReplaceAll
    </code>
    Windows is *very* particular about such details.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts

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

    Thanks Hans!

    It works great.

    Jim

  6. #6
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

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

    Hi James,

    Take a look at my Field Link Updater in <post#=261488>post 261488</post#> and the methods for implementing relative paths in Word, in <post#=670027>post 670027</post#>:
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  7. #7
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    Thanked 0 Times in 0 Posts

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

    Hello Paul,

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

    Cheers!

    Jim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •