Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Thanked 0 Times in 0 Posts

    cite scan macro (2000)

    I'm trying to scan a manuscript for bibliographic citations (in scientific form).... How do I write a macro that finds a left paren followed by any digit [0-9], then backs up by 5 words (as one would do by pressing CTL-Left Arrow), then inserts a paragraph mark and a nonsense string (like "zzz").

    I need it to loop and repeat until it hits an EOF. I've done a fair amount of programming -- mostly years ago -- but don't understand WordBasic at all -- and can't find any books on it except one that try to teach programming basics also.
    Thanks much!! - Randy

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: cite scan macro (2000)

    Randy, here are the steps I suggest, in "pseudocode"

    (1) Set up find object with your wildcard search (as discussed in earlier thread). Easiest way is to record a macro of doing the search once. Make sure the wrap property is WdFindStop.

    (2) Set up a Do loop that does this:

    (a) Execute the find and exit if nothing was found:

    If Selection.Find.Execute() = False Then Exit Do

    ([img]/forums/images/smilies/cool.gif[/img] Extend the selection backwards 5 words using:

    Selection.MoveStart wdWord, -5

    Insert the desired text before the expanded selection:

    Selection.Range.InsertBefore vbCrLf & "zzzzz"

    (d) Collapse the selection beyond the previously found text:

    Selection.Collapse wdCollapseEnd

    (e) Loop

    Hope this helps.

Posting Permissions

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