Results 1 to 3 of 3
  1. #1
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post

    Inserting Characters (Word XP)

    I know very little about VBA objects in Word. I couldn't even get the macro record to do this. What I am trying to do is select text and then run a macro that will insert the character { at the beginning of the selected text and the character } at the end of the selected text. That text could be over several paragraphs. How would I code this? I'm sure this is probably easy but until I learn Word VBA objects it will take me a very long time. Thanks.
    You know it's time to diet when you push away from the table and the table moves.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Inserting Characters (Word XP)

    I have an old sample macro in <post#=500,069>post 500,069</post#>. It finds bold text and surrounds it with HTML tags. The main methods used is for this are:

    <code>Selection.InsertBefore ""
    Selection.InsertAfter "
    "</code>

    I'm sure there are other ways, but this one is pretty straightforward.

  3. #3
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Inserting Characters (Word XP)

    Hi Jefferson. Thanks for replying. I used the code you provided and, of course, it worked. I knew it had to be easy to do and now I will know how next time. Thanks for your help!
    You know it's time to diet when you push away from the table and the table moves.

Posting Permissions

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