Increment Bookmark name?

Discussion in 'Word VBA Beginners' started by Basalt, Apr 30, 2011.

  1. Basalt

    Basalt Guest

    I have an english and a spanish version of a word form. I have created
    a macro to check the corresponding box in spanish when the english box
    is checked. However, the bookmark name is hardcoded in the macro so
    the macro only works on the first box of each version - checkbox1 and
    checkbox76. Is there a way for me to have the macro increment the
    bookmark name so it correctly marks the checkbox? Such as:

    {checkboxname} + 75

    or some better way?

    Basalt, Apr 30, 2011
    1. Advertisements

  2. Basalt

    Jay Freedman Guest

    You can do something like this:

    For i = 1 To 75
    englishCheckboxName = "checkbox" & i
    spanishCheckboxName = "checkbox" & (i + 75)

    ActiveDocument.FormFields(spanishCheckboxName).Result = _
    Next i
    Jay Freedman, May 2, 2011
    1. Advertisements

  3. Basalt

    Basalt Guest

    Basalt, May 2, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.