Find and Replace finds text in a textbox if you set .Wrap = wdFindContinue
(equivalent to using 'ALL' in the Search drop down, as opposed to UP or
DOWN).
But an easier approach is to use a DocProperty field, then in code all you
need do is set the property and update fields.
>I need to use VBA to open a doc file find a placeholder in a text box and
> then replace it with a date. Eg the text is XXXXXX. and this needs to be
> replaced with date field. I can do this fine if the XXXXXX is in a normal
> documnet, but when I try and do it for a text box it cant find it. Can
> anyone
> please help?
Ocean - 27 Mar 2006 12:27 GMT
Thanks for this - can you explain this bit further :
But an easier approach is to use a DocProperty field, then in code all you
need do is set the property and update fields.
Many thanks
> Find and Replace finds text in a textbox if you set .Wrap = wdFindContinue
> (equivalent to using 'ALL' in the Search drop down, as opposed to UP or
[quoted text clipped - 9 lines]
> > anyone
> > please help?
Jezebel - 27 Mar 2006 22:22 GMT
1. Go to File > Properties. On the Custom tab add a property called whatever
you like (eg 'MyDate'). Assign a dummy value.
2. In the body of the document, wherever you want this value to appear,
insert a DocProperty field: {DocProperty MyDate}
3. In your code, set the property using
ActiveDocument.CustomProperties("MyDate") = "22-Mar-2006"
ActiveDocument.StoryRanges(wdTextFrameStory).Fields.Update
> Thanks for this - can you explain this bit further :
>
[quoted text clipped - 21 lines]
>> > anyone
>> > please help?