SteveC
Wed Mar 16 10:47:05 CST 2005
Thanks, Jay! I will give that a shot.
Steve C
"Jay Freedman" wrote:
> On Mon, 14 Mar 2005 12:59:07 -0800, "Steve C"
> <SteveC@discussions.microsoft.com> wrote:
>
> >I've created a text box in a userform in the VB Editor where a user inserts a
> >date. I'm trying to then have the code search the document for each instance
> >of the words "Created Date:", which appears in the first row and first cell
> >of a varying number of two column tables (The number of tables where "Created
> >Date" appears will vary, depending on another prompt in my form). Each time
> >"Created Date" is found in a table, I want to have the date that was input in
> >the form to be inserted in the cell immediately below "Created Date".
> >
> >I hope I'm being clear enough. Thanks in advance for your help!
> >
>
> Instead of doing a find & replace, there's a better way. In the
> template for these documents, include a {DocVariable CreatedDate}
> field in each place you want this value to appear. In the userform's
> Click event for the OK button, include code like this (of course, you
> need other code to validate the entry):
>
> ActiveDocument.Variables("CreatedDate").Value = TextBox1.Text
> ActiveDocument.Fields.Update
>
> If you're creating tables on the fly as it sounds like you're doing,
> you can put the DocVariable field in the proper cell at the time the
> table is created.
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ:
http://word.mvps.org
>