Results 1 to 7 of 7
  • Thread Tools
  1. New Lounger
    Join Date
    Dec 2004
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hello Kind People

    I have created a Word 2007 template with a userform. In the userform the user inputs a name once and I have the name bookmarked to appear 3 different times in the document. In the first instance of the name in the document, I want it to be in all capital letters and in the other 2 instances I would like the name to appear in initial caps. Can someone give me some code to do this please. Thanks for any and all help.

  2. Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 10 Times in 10 Posts
    Right-click one of the references.
    Select "Toggle field codes" from the popup menu.
    You'll see something like { MyBookmark } or { REF MyBookmark }
    For all caps, insert \* Upper before the closing brace so that it looks like { MyBookmark \* Upper }
    For initial caps, insert \* Caps before the closing brace so that it looks like { MyBookmark \* Caps }
    Press F9 to hide the field code and to update the result.

  3. New Lounger
    Join Date
    Dec 2004
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I'm sorry, but I failed to mention that I created my own custom userform, so there is no reference.

  4. Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 10 Times in 10 Posts
    What code do you use to insert the name into the document?

  5. New Lounger
    Join Date
    Dec 2004
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts
    .bookmark ("clientname").Range.Text=txtclient.Value
    .bookmark ("clientname2").Range.Text=txtclient.Value
    .bookmark ("clientname3").Range.text=txtclient.Value

    The user enters the client name once in a textbox (txtclient) in the user form and it shows up 3 times on the document. I was hoping to keep this simple method only with a variation to make the first bookmark all caps.

  6. Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 10 Times in 10 Posts
    I assume that you meant .Bookmarks instead of .bookmark.

    Change the code to

    .Bookmarks("clientname").Range.Text = UCase(txtclient.Value)
    .Bookmarks("clientname2").Range.Text = StrConv(txtclient.Value, vbProperCase)
    .Bookmarks("clientname3").Range.Text = StrConv(txtclient.Value, vbProperCase)

  7. New Lounger
    Join Date
    Dec 2004
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you so much! That worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •