I think there's maybe a little misunderstanding here. From your description
you want to set the value of the bookmark text within the document; but your
code seems to be trying to insert text in front of the bookmarks.
To replace the content of a bookmark, use
ActiveDocument.Bookmarks("accountnumber").Range = TextBox1
etc
Note that this deletes the bookmark. You need to redefine it if you need to
be able to run the code more than once.
Having said all that, a better way to do this sort of thing is to use
Document Properties and DocProperty fields. The advantages are a) you can
insert the same piece of data in any number of places in the document in one
step (instead of having to set multiple bookmarks); b) you don't have to
muck around directly with the content of the document; and c) the property
doesn't get deleted when you set the value.
Hi Jezebel and thank you for your help. I think my waffle may have been
a little misleading, my apologies it was written in the last 5 minutes
of my day at work and I had code coming out of my ears!
I need to insert text at a bookmark (which the code does at the
moment)...
Then need to have control over the text that has been inserted, i.e. be
able to:
ElseIf OptionButton2.Value = True Then
> > pleasenote = "per annum and your regular <termly> payments will be
> > $<amount> commencing <date>."
Insert this text, then input the <termly>, <amount>, and <date>,
possibly on a follow up form?
Russ - 09 Oct 2006 03:08 GMT
Newforms,
> Hi Jezebel and thank you for your help. I think my waffle may have been
> a little misleading, my apologies it was written in the last 5 minutes
[quoted text clipped - 4 lines]
> Then need to have control over the text that has been inserted, i.e. be
> able to:
Your description is still a little confusing. You already had control over
the text before you inserted it. Otherwise you wouldn't have been able to
insert it. Can't you test it just before you insert it?
> ElseIf OptionButton2.Value = True Then
>>> pleasenote = "per annum and your regular <termly> payments will be
>>> $<amount> commencing <date>."
>
> Insert this text, then input the <termly>, <amount>, and <date>,
> possibly on a follow up form?

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID