Can't delete the space between bookmarks

J

joseph

My question concerns a word template with a userform. The template has,
among others, two bookmarks that need to be back-to-back. The first mark is
for the name of a person. The second bookmark includes the phrase (without
quotations): ", et al." (note that the bookmark leads with a comma, so it has
to be immediately adjacent to the first bookmark). When only the first
bookmark has a value, the result should be: "John" When both bookmarks have
value, I want the result to be: "John, et al." So, I just put them back to
back, as follows: [][]. But that really confuses Word, and it either omits
one of the bookmarks or switches their places: ",et al. John" Not good.

So, right now, I've got them set up with a space in between the bookmarks:
[] [], which results in: "John , et al." (with the space intact). How do I
code that space out of there?

Relevant portions of my code currently read:

With ActiveDocument
.Bookmarks("Name").Range = txtName.Text
.Bookmarks("Etal").Range = strEtal
End With

Thank you in advance.
 
G

Graham Mayor

In answer to both your questions, you don't need multiple bookmarks when all
the information is to be pasted in the same location. You can assemble the
text to be inserted and either write it all in or at the bookmark, or you
could write it to a docvariable and put a docvariable field in the document
to place the content of the doc variable. There are some examples at
http://www.gmayor.com/SelectFile.htm that demonstrate an assortment of
methods.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top