J
Jan DOUMEN
Hi,
I'm been struggling with a renaming formfields problem. There are
numerous post available on how to rename formfields, with or without
empty bookmark. I've merged two sample codes that people posted to
result in:
For Each oFormField In ActiveDocument.FormFields
If oFormField.Range.InRange(oTable.Range) Then
oFormField.Range.Select
With Dialogs(wdDialogFormFieldOptions)
.Name = "blah_" & i
.Execute
End With
i = i + 1
End If
Next oFormField
When executing this code from a button in a word form, I end up in an
endless loop in the first cell of the table that contains a formfield.
He is selecting the first formfield over and over again. When I halt
the code, the bookmark is something like "blah_39", so it is counting
up nicely.
I had first tried renaming the formfields without the dialogs trick,
in the most simple way:
oFormField.Name = "blah_" & i
I end up with the famous Runtime error "2147467259" : method Name of
object FormField failed.
Funny enough
oFormField.Result = "blah_" & i
is working nicely.
Any more hints on how to rename all formfields in a table?
Thanks in advance,
Greetings,
I'm been struggling with a renaming formfields problem. There are
numerous post available on how to rename formfields, with or without
empty bookmark. I've merged two sample codes that people posted to
result in:
For Each oFormField In ActiveDocument.FormFields
If oFormField.Range.InRange(oTable.Range) Then
oFormField.Range.Select
With Dialogs(wdDialogFormFieldOptions)
.Name = "blah_" & i
.Execute
End With
i = i + 1
End If
Next oFormField
When executing this code from a button in a word form, I end up in an
endless loop in the first cell of the table that contains a formfield.
He is selecting the first formfield over and over again. When I halt
the code, the bookmark is something like "blah_39", so it is counting
up nicely.
I had first tried renaming the formfields without the dialogs trick,
in the most simple way:
oFormField.Name = "blah_" & i
I end up with the famous Runtime error "2147467259" : method Name of
object FormField failed.
Funny enough
oFormField.Result = "blah_" & i
is working nicely.
Any more hints on how to rename all formfields in a table?
Thanks in advance,
Greetings,