• Inserting Characters (Word XP)

    Author
    Topic
    #446265

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #1084369

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

      Selection.InsertBefore ""
      Selection.InsertAfter "
      "

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

      • #1084371

        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!

    Viewing 0 reply threads
    Reply To: Inserting Characters (Word XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: