Consulting

Results 1 to 5 of 5

Thread: Searching for text and formatting it

  1. #1
    VBAX Newbie
    Joined
    Jan 2012
    Posts
    3
    Location

    Searching for text and formatting it

    Hey! I am asking if there was a way (I'm sure there is) for my code to search through my document for a certain string, proceed to select the entire line that text is in, and then format it. And, of course, continue searching for any other instances of the text. Thanks in advance!

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Hi timeel,

    Are these 'lines' whole paragraphs, or at least terminated by manual line breaks? If so, a wildcard Find/Replace would probably do the job.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Newbie
    Joined
    Jan 2012
    Posts
    3
    Location
    They're terminated by manual line breaks. How would a wildcard find/replace work? I know VBA from Excel, so I'm not too savvy on certain Word functions.

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Hi timeel,

    For a wildcard Find/Replace, you could use:
    Find = [!^l^13]@text to find*[^l^13]
    Replace = ^&
    and set the replacement formatting to whatever you want.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    VBAX Newbie
    Joined
    Jan 2012
    Posts
    3
    Location
    Thanks!

Posting Permissions

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