Increment Bookmark name?

B

Basalt

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}
{checkboxname} + 75

or some better way?

Thanks!
Jason
 
J

Jay Freedman

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}
{checkboxname} + 75

or some better way?

Thanks!
Jason

You can do something like this:

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

ActiveDocument.FormFields(spanishCheckboxName).Result = _
ActiveDocument.FormFields(englishCheckboxName).Result
Next i
 
B

Basalt

You can do something like this:

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

   ActiveDocument.FormFields(spanishCheckboxName).Result = _
      ActiveDocument.FormFields(englishCheckboxName).Result
Next i

Thanks!
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top