+ Reply to Thread
Results 1 to 2 of 2

Thread: Word Macro to insert text at end of every row

  1. #1
    Registered User
    Join Date
    03-31-2010
    Location
    Portland, OR
    MS-Off Ver
    Excel 2007
    Posts
    38

    Word Macro to insert text at end of every row

    Hello there.

    I am familiar with macros in excel, but would appreciate some help on this one.
    Here are some of the things I need to do. In a word doc with lets say thousands of lines of text, I need a macro that will insert a bit of text at the end of each and every line. I would also need to create another macro that would insert another bit of text at the beginning of every line. Thirdly, a macro that could insert text of my choosing after the nth character of every line. Those three macros would make my life VERY VERY easy since I need to go through tens of thousands of lines and really don't want to cut and paste each one.

    Any help would be greatly appreciated!

    Please see sample file for clarification.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-31-2010
    Location
    Portland, OR
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Word Macro to insert text at end of every row

    Hello everyone. I found some code that gives me the ability to insert text at the beginning of every line and also at the end of every line:
    Sub AddHello()
    Dim oRg As Range
    Set oRg = Selection.Range
    With oRg.Find
    .MatchWildcards = True
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "([!^13]{1,}^13)"
    .Replacement.Text = "hello\1"
    .Wrap = wdFindStop
    .Execute Replace:=wdReplaceAll
    End With
    Set oRg = Nothing
    End Sub

    I'm 2 thirds the way there! What I really need now is a macro that will insert text every nth character of every row. Anyone have any ideas?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0