Results 1 to 4 of 4

Thread: Macro Question

  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro Question

    I am using MS Word 2010 and Windows 7.

    The macro was recorded as the steps were being done.

    The macro is supposed to select the text from the insertion point until it finds a parenthesis, move back one character (parenthesis is not supposed to be bolded), bold the text including the space, and then move one character to the right. Very simple macro. Nothing fancy.

    The problem I am having is that the macro does not let go of the selection. Meaning, it is not acknowledging the "moveright" command in the macro.

    I checked my old computer and copied the macro from my old computer and tried it both ways, and both ways the macro does not let go of the selection.

    Anybody seen this problem yet? Or Does anyone know how to solve it?

    Thanks in advance.

    ===

    Sub Macro5()
    Selection.Extend
    Selection.Extend Character:="("
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Font.Bold = wdToggle
    Selection.Font.BoldBi = wdToggle
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    End Sub

  2. #2
    5 Star Lounger kmurdock's Avatar
    Join Date
    Feb 2003
    Location
    Pacific Grove, California, USA
    Posts
    716
    Thanks
    10
    Thanked 34 Times in 28 Posts
    Try adding the line

    Selection.Collapse wdCollapseEnd
    or
    Selection.Collapse wdCollapseStart

    as the last line of your above code. Use one or the other depending on where you want the insertion point when it collapses.

    Kim

  3. #3
    2 Star Lounger
    Join Date
    Jun 2001
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Kim. That did the trick.

  4. #4
    5 Star Lounger kmurdock's Avatar
    Join Date
    Feb 2003
    Location
    Pacific Grove, California, USA
    Posts
    716
    Thanks
    10
    Thanked 34 Times in 28 Posts
    Great. Glad I could help.

Posting Permissions

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