• WD2K: Bookmarks in HEader/Footers (VBA, W2K, O2K)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » WD2K: Bookmarks in HEader/Footers (VBA, W2K, O2K)

    Author
    Topic
    #392932

    Hi,

    I have a procedure that inserts a legal disclaimer in the footer at the last page of my document
    After the insertion it adds a bookmark in the beginning of the disclaimer with the .add method.

    Prior to publishing my document, I need to find the disclaimer and update it to the most recent version.
    The below code is a snap that is expected to handle this. Most of it goes OK, I get into the correct footer, verifies that the bookmark exists, but then comes troubles…

    ActiveWindow.View.SeekView = wdSeekCurrentPageFooter
    If ActiveDocument.Bookmarks.Exists(Name:=”zBP_Disclaimer”) = True Then
    Selection.GoTo what:=wdGoToBookmark, Name:=”zBP_Disclaimer”
    End If

    When I use the .goto it fails with err.number “Run-time error ‘5678’ – Word cannot find the requested bookmark”
    – then I select debug… and the selection exists the footer and goes back to printview (which puzzles me a bit)

    My question is: being in the footer – why can’t I use the .goto here…???

    Thanks,

    Viewing 1 reply thread
    Author
    Replies
    • #709097

      I don’t know why it doesn’t work, but try this:

      ActiveWindow.View.SeekView = wdSeekCurrentPageFooter
      If ActiveDocument.Bookmarks.Exists(Name:=”zBP_Disclaimer”) Then
      ActiveDocument.Bookmarks(“zBP_Disclaimer”).Select
      End If

    • #709098

      I don’t know why it doesn’t work, but try this:

      ActiveWindow.View.SeekView = wdSeekCurrentPageFooter
      If ActiveDocument.Bookmarks.Exists(Name:=”zBP_Disclaimer”) Then
      ActiveDocument.Bookmarks(“zBP_Disclaimer”).Select
      End If

    Viewing 1 reply thread
    Reply To: WD2K: Bookmarks in HEader/Footers (VBA, W2K, O2K)

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

    Your information: