• Help with Link Fields inside a header

    Author
    Topic
    #463575

    On a 2007 word document that I’m using, it has mutable link fields throughout, that re-fresh just fine upon opening of the document; it is just the link fields that are located inside of a header that I receive an Error! Not a valid link. I have checked and verified that the link still exist by using Shift/F9. Here is the code that I use to open document with.

    Code:
    Set worddoc = Documents.Open(ThisDocument.Path & " ReportsClient Information.docm")
    worddoc.Windows(1).Activate
    

    Is there anything that I can add to this code that may refresh the links in the header?
    Also I have the annoying message every time this document opens. Is there a way to eliminate this?

    Viewing 2 reply threads
    Author
    Replies
    • #1183913

      What are the field codes, exactly?

      Does anything in this thread help or ring a bell? Relative Paths in Word Fields (March 2009)

    • #1183916

      About the prompt: there is a registry setting that controls it.
      – Click Start | Run…
      – Type regedit and press Enter or click OK.
      – Navigate to HKEY_CURRENT_USERSoftwareMicrosoftOffice12.0WordOptions.
      – Look for a value in the right hand pane named FieldCalcSecurityLevel.
      – If there is no such value, select Edit | New | DWORD Value, provide FieldCalcSecurityLevel as name and click OK.
      – Double-click FieldCalcSecurityLevel and set its value to 0.

    • #1183917

      This post (click!) contains a macro that will update all fields in all storyranges (parts) of a document.

      • #1183964

        Thank You HansV
        I just read over the comments of the other thread, very cool thanks
        I shall give it a try

      • #1184036

        Hi HansV
        I tried using the method you left on post 718,492
        It did not seem to refresh the links in the header, all the other links on same document refresh just fine. I double checked to be sure the links was correct by using Shift/F9. It all looks good.
        I went through some of my old post and found that you help me with a linking problem before (I’m sure more than once). Here is one code you gave to me to help refresh my link fields on a read only document.

        Code:
        Sub AutoOpen()
          Dim fld As Field
            ActiveDocument.Unprotect "Password here"
          For Each fld In ActiveDocument.Fields
            fld.LinkFormat.Update
          Next fld
          ActiveDocument.Protect wdAllowOnlyReading, "Password here"
        End Sub
        

        Is there a way to add something to my existing code (Posted earlier on this thread)
        I tried to modify your previous code, but with no success?

        Code:
        Dim fld As Field
          ActiveDocument.Unprotect "Password here"
          For Each fld In ActiveDocument.Fields
            fld.LinkFormat.Update
          Next fld
          ActiveDocument.Protect wdAllowOnlyFormFields, "Password here"
        

        I like being able to have protection for my form fields

        • #1184052

          You’d have to loop through the storyranges as in the code I provided a link to.

          Another option is to briefly display the print preview; provided that Word has been set to update fields on print, that should update all links:

          Application.ScreenUpdating = False
          ActiveDocument.PrintPreview
          ActiveDocument.ClosePrintPreview
          Application.ScreenUpdating = True

          • #1184116

            Hi HansV
            I tried so many different ways to have link fields refresh in the header or even footer
            What I did find was when I copied the text that I wanted to link to other pages, then used
            Paste Special Microsoft Office Word Document Object Paste Link , then press OK
            The links work great in both header and footer, no coding needed, even with protection or not, it still seems to refresh with no problems.
            But now I am having a problem with adjusting the size and color of text, it does not seem to want to make changes; the links work great though….lol

            • #1184568

              Any suggestions would be greatly appreciated
              I tried everything I can think of, does anyone know of a way that I can change the font color / size and type using a linked object
              Paste Special Microsoft Office Word Document Object Paste Link , then press OK

            • #1184571

              If you select Microsoft Word Document Object, the formatting is entirely determined by the source document. There is no way whatsoever you can change the formatting in the target document.

              If you want to be able to change the formatting in the target document, you must select Formatted Text, Unformatted Text or HTML.

            • #1184582

              Thank you HansV
              That was my dilemma; my source document formatting was different than my target document and in order for my links to refresh in my source document header I had to use Microsoft Word Document Object. I know I could have copied from link source, then using unformatted text to make needed adjustments, then use Microsoft Word Document Object to link to target document header. The problem I had there was, there was no place I could of hidden unformatted text on source document, not quite the same as an excel workbook where you can evertything.

              All my other links that are outside my header or footer I use Formatted Text, Unformatted Text and they work great. Once again I thank you for all of your assistance, no better way to learn than hands on

    Viewing 2 reply threads
    Reply To: Help with Link Fields inside a header

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

    Your information: