• WSChris Scott

    WSChris Scott

    @wschris-scott

    Viewing 4 replies - 1 through 4 (of 4 total)
    Author
    Replies
    • in reply to: Word Relative Field Paths Discussion #1260351

      Hi,

      Yes the the hyperlink still shows the path to the old location and the link is still valid.

      This MsgBox still gives an error. Same as before with the OldPath not being set.

      Also, in the OldPath variable set, this portion – .LinkFormat.SourceFullName – is giving the message .

      Thanks

    • in reply to: Word Relative Field Paths Discussion #1260256

      Hi Chris,

      Actually, that message box shouldn’t be there – it’s left over from testing. I’ll have to remove it.

      Nonetheless, that doesn’t solve your problem. Are you adding the code to a new (unsaved) document, or to an existing document?

      Hi,

      Ok. And I am adding it to an existing document.

      Thanks

      Edit: So I removed the msg box line and also created a new document to test it in. I am still getting the error with it not being able to find the OldPath. It is now occurring in this line:

      If OldPath NewPath Then .LinkFormat.SourceFullName = _
      Replace(.LinkFormat.SourceFullName, OldPath, NewPath)

      There seems to be an error setting the OldPath variable. Could this possibly have something to do with Hyperlinks? What would you suggest I do?

      Thanks

    • in reply to: Word Relative Field Paths Discussion #1260206

      Hi Chris,

      I see you’re working with docx files, which suggests Word 2007 or later. Word 2007 introduced some changes to the way fields with external links are handled, and this may be one of its victims. The macro solution should still work, though.

      It seems as though I am having the same issue as some else. It is giving me error 91 when running the macro.

      I included that extra code line and it still won’t work. I have deduced that the issue is that it cannot find the old path. Here is the line that it now fails at:

      MsgBox OldPath & vbCr & NewPath & vbCr & Replace(.LinkFormat.SourceFullName, OldPath, NewPath)

      When hovering my mouse over the OldPath item there are just empty quotes (” “).

      Thanks!

    • in reply to: Word Relative Field Paths Discussion #1260082

      Hi Macropod,

      I have been trying your method of creating relative links and it is still giving me some trouble. It seems as though once I save and close the document that the FILENAME field changes from an updatable field, to just the path.

      The ‘main’ document that I am using is located here: D:Installation Files– Next Co-op Student –Co-op Resources Guide-good – Copy.docx. This is the document that I created the FILENAME field in, so that may be why it is showing up in the re-opened doc.

      Here is the field code before closing: { HYPERLINK “{ FILENAME p }\..\01 PEAKS Testing 5.2” }

      And then after re-opening: { HYPERLINK “file:///D:\Installation%20Files\–%20Next%20Co-op%20Student%20–\Co-op%20Resources%20Guide-good%20-%20Copy.docx\..\01%20PEAKS%20Testing%205.2” }

      I was wondering if you could help me figure out why this is happening.

      Thanks!

      Edit: Also I should note that when the file is re-opened the hyperlink still works.

    Viewing 4 replies - 1 through 4 (of 4 total)