Results 1 to 3 of 3

Thread: [RESOLVED] inserting a "("

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    39

    Resolved [RESOLVED] inserting a "("

    I have a macro in word, I would like to insert a "(" at the end of the active document then go back to the beginning and run the macro as I have it right now. Can someone help with this?

    I am obviously a n00b

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: inserting a "("

    I assume you only want to add the opening brace once only? Otherwise you might end up with an infinite loop.
    VB Code:
    1. Sub wooonellymacro()
    2.    
    3.     'All you existing code here.
    4.     '....
    5.    
    6.     'Add this code
    7.     With ThisDocument
    8.         'Check if the last character is a opening brace
    9.         If .Characters(.Characters.Count - 1) <> "(" Then
    10.             'If not then add one and rerun this procedure
    11.             .Range.InsertAfter ("(")
    12.             wooonellymacro
    13.         End If
    14.     End With
    15. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    39

    Re: inserting a "("

    Cool thank you very much

Posting Permissions

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



Click Here to Expand Forum to Full Width