+ Reply to Thread
Results 1 to 3 of 3

HELP! Can't correctly create Find & Replace macro routine for Word doc

  1. #1
    Registered User
    Join Date
    12-07-2012
    Location
    London, England
    MS-Off Ver
    Office 2010
    Posts
    81

    Unhappy HELP! Can't correctly create Find & Replace macro routine for Word doc

    Hi,

    I'm having to do a lot of formatting to a Word DOCM doc, using VBA to clean it up (it's eventually going to be a database file). I've managed to do most of it ok, but there is one thing that I absolutely cannot figure out, no matter what I try. It's this: I need to do a find and replace, and can't find the way to make it work.

    The file is hundreds of pages, in single column format. The lines look like this:

    ab ab
    blab (z,d) blab
    dab (z,d) dab
    drab drab
    fab fab
    flab flab
    gab (z,d) gab

    Now, the problem is this. The lines that DON'T already have something in braces need to have them inserted artificially. It will always be (-,-).

    SO the search/replace needs to do this:
    Go to the first line in the doc.
    Where there isn't something in braces after the first word, insert (-,-).
    Look at the next line. do that if needed.
    Repeat to end of doc.
    Sounds simple, but I'll be damned if I can make it work!

    Any help with this will be deeply appreciated.

    Thanks in advance.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,967

    Re: HELP! Can't correctly create Find & Replace macro routine for Word doc

    1. Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.


    2. Your post does not comply with Rule 5 of our Forum RULES. We have Seven question forums: Miscellaneous, General, Programming, Worksheet Functions, Charting, Excel 2007 Help and New Users. Please choose the appropriate forum, and post your question in ONLY one forum. --> MS Word, maybe?

    3. The best way to get help is to provide samples that acurately reflect your actual data. That which you posted is, er....
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    12-07-2012
    Location
    London, England
    MS-Off Ver
    Office 2010
    Posts
    81

    Re: HELP! Can't correctly create Find & Replace macro routine for Word doc

    Hi. Wrote a reply to you and it vanished. Will post in the Word forum, which I didn't spot earlier. As for the data, I didn't present some sort of pseudo data; that is the actual data. It's the first few lines of 200 pages I've been given so far (after I stripped out titles and all sorts of other stuff). It's driving me mad. It will be imported into Excel eventually, and more processing will be done there. But if I can get these inserts done, then it should all line up nicely and be easy to do. You really don't want to see the original. Actually, you couldn't; you don't have the font needed. I'm just amazed I managed to massage it to the state it is now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1