NanaHawk
05-24-2011, 11:02 AM
Hi Everyone,
first post from me so please be gentle :-)
I have several hundred documents that contain DOCVARIABLE fields and I want a user to be able to select their chosen and document and then for VBA code to iterate through it and provide prompts for the associated value.
All works well until the field & variable have a space in their name and then the variable is created but the update does not work.
Is it possible to utilise fields with a space in the name or not?
The code below shows the kind of code I'm using:
For Each myfield In ActiveDocument.Fields
myFieldName = Trim(Mid(myfield.Code, 14, 99))
ActiveDocument.Variables(myFieldName).Value = "Update to something new"
Next myfield
ActiveDocument.Fields.Update
Any and all input would be appreciated.
first post from me so please be gentle :-)
I have several hundred documents that contain DOCVARIABLE fields and I want a user to be able to select their chosen and document and then for VBA code to iterate through it and provide prompts for the associated value.
All works well until the field & variable have a space in their name and then the variable is created but the update does not work.
Is it possible to utilise fields with a space in the name or not?
The code below shows the kind of code I'm using:
For Each myfield In ActiveDocument.Fields
myFieldName = Trim(Mid(myfield.Code, 14, 99))
ActiveDocument.Variables(myFieldName).Value = "Update to something new"
Next myfield
ActiveDocument.Fields.Update
Any and all input would be appreciated.