Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Stone Ridge, New York, USA
    Thanked 0 Times in 0 Posts

    Incrementing up bookmarks in formula fields (VBA W


    I'm using some code to increment up formfield bookmarks when an additional row is added to a table. So if a 10th row is added the bookmark in the formfield would be renamed with a 10 following it. Each row has a calculation formula in one of the cells that calculates the bookmarked items. Does anyone know of a way to rename the bookmarks that are contained in the formula and increment them up like I'm doing with the formfield bookmarks? This is a protected form.

    Thanks in advance.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 93 Times in 89 Posts

    Re: Incrementing up bookmarks in formula fields (VBA W

    Are you sure rows will only be added to the end of the table? Hmmm...

    Perhaps the best method, assuming no rows would ever be deleted, would be to use the table's row count:

    Dim intNewRowNum as Integer
    intNewRowNum = Selection.Tables(1).Rows.Count ' - 1 ' if table has a header row

    If the table has a heading row with no form fields, you could "uncomment" the - 1 in the second line above to adjust the count to the actual number of rows with form fields.

    As for how to use this, I don't remember exactly how you set the bookmark name for a form field after adding it, but it would be in the same part of your code where you set the other properties of the field and Intellisense probably will prompt you with the property name.

    Hope this helps.

  3. #3
    Super Moderator
    Join Date
    May 2002
    Canberra, Australian Capital Territory, Australia
    Thanked 406 Times in 335 Posts

    Re: Incrementing up bookmarks in formula fields (VBA W

    Hi Sherry,

    The attached may give you something to work with. Among other things, it shows how to use relative row references in Word tables. You may be able to adapt the process to your needs.


    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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