It's a bit late, but your question came up when I was looking for the same answer. :-)
For flexibility, the actual work is done as a function, where the field code is received as a string. That way I can call the function with any desired field code, not necessarily a specific SEQ or any field code at all.
Function UpdateSpecificFields(MyFieldCode As String)
Dim MyField As Field
For Each MyField In ActiveDocument.Fields
' Debug.Print """" & MyField.Code & """" & MyField.Result
If InStr(1, MyField.Code, MyFieldCode) <> 0 Then
MyField.Update
End If
Next MyField
End Function
We're looping through all the fields within the active document. You could include a test of whether MyField.Type = wdFieldSequence
to reduce the unnecessary work.
The InStr is there in case of odd spacing; sometimes the field creator might include an extra space before or after the code itself, so I didn't want to be too literal. (I suppose there should have been a trim()
to get rid of said spaces but I was getting a little lazy.)
Usage: Call the function from a sub.
Sub UpdateSEQQs()
UpdateSpecificFields ("SEQ Qs")
End Sub
I have a SEQ
called Qs
, so you can see how it was called above. Hope this helps someone!