50 Ask fields? Which genius thought that one up?
This 'simple' date change is going to be a major undertaking. I can't see
how we can proceed with this without seeing the document(s). Without an in
depth knowledge of the structure of the document it is not possible to see
how the various fields interact.
If you cannot update the fields, then you are also going to have to locate
the cross references to the StartDate bookmark and update them individually.
It might be simpler to look for all the other fields in the document and
convert them to text so they cannot change. All depends on what you want to
achieve with these documents.
The following code will unlink all the fields but the startdate fields.
Dim iFld As Integer
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If InStr(1, .Code, "StartDate") = 0 Then
.Unlink
End If
End With
Next iFld
You can then use my previous suggestion to change the startdate content.

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> I would prefer to be able to select the specific bookmarks and change
> them as I can't do a simple search and replace any more because the
[quoted text clipped - 59 lines]
>>>
>>> Gordzilla
Gordzilla - 27 Sep 2006 14:13 GMT
I agree, but unfortunately this is what I'm stuck with. I'm afraid I cant'
post the documents as the format and content a confidential to our client.
I can explain a little more about the document.
There are no external data sources, everything is stored within each word
file.
Based on the field code, I assumed this is a bookmark, correct me if I'm
wrong.
{Ask startdate "Enter Start Date (yyyy-mm-dd)" \d "yyyy-mm-dd" \*
MERGEFORMAT} {REF startdate \* MERGEFORMAT}
The start date and other "ask" fields are not cross reference anywhere else
within the document. They only appear in the one location where the above
code is.
I know that the field is number 9 in the field index and if I use a msgbox
to display the item using:
MsgBox ActiveDocument.Fields(9).Result
the startdate value is displayed. I was hoping that there would be a simple
method.
like ActiveDocument.Fields(9).Result = "2007-01-01"
Sorry if I'm not providing enough info, but I haven't had to deal with VBA
and fields before.
> 50 Ask fields? Which genius thought that one up?
>
[quoted text clipped - 85 lines]
> >>>
> >>> Gordzilla
Graham Mayor - 27 Sep 2006 15:47 GMT
Startdate is certainly a bookmark - you Ask for the bookmark content then
write that content with the REF field.
The problem is all the other ASK and REF fields which you want to leave as
they are. It was for this reason I suggested in my last post that they be
unlinked and thus converted to text, so it doesn't matter if the fields are
updated. The code I posted earlier will do that, leaving only the startdate
field to deal with.
You cannot do search and replace into fields readily - though you can write
fields with vba. I therefore suggested replacing the ASK field with a SET
field to incorporate the new date that you wanted, by first copying that SET
field to the clipboard and use the replace option to replace the ASK field
with the clipboard content and then update the fields to make the REF field
show the new startdate.
Both pieces of code can be incorporated in a batch processing macro.
I would try it out on a couple of copy documents in a folder of their own ;)

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> I agree, but unfortunately this is what I'm stuck with. I'm afraid I
> cant' post the documents as the format and content a confidential to
[quoted text clipped - 122 lines]
>>>>>
>>>>> Gordzilla